最近娱乐圈可谓各种风波不断,先是所谓的两宋离婚,然后是范冰冰和李晨分手,而且每到这个时候还总有人到汪峰的微博留言,估计微博的运维工程师已经要崩溃了。 目前北京、上海等一线城市的离婚率已经接近50%,所以娱乐圈的种种分分合合只是这种趋势的一个缩影而已。不过虽然没有具体数据支持,不过笔者身边的程序员群体几乎都是从一而终,很少听到婚变的传闻,这可能是程序员们的脑力都铺在了工作上,生活中比较能忍让的原因吧。所以这里笔者也为广大程序员们说一句,如果你的对象是IT人那么请你珍惜,他们性格单纯,感情专一,是伴你一生一世的选择。

     
 笔者周末在github上去搜索了一下有关love及dating等主题,果然有惊喜,下面就总一些比较经典的项目给各位介绍一下,来感受一下程序员的浪漫吧。

              如何找到心仪的小姐姐、小哥哥

      在笔者在之前的博客中也曾经做过一些有关婚恋的大数据分析
https://blog.csdn.net/BEYONDMA/article/details/88889252
<https://blog.csdn.net/BEYONDMA/article/details/88889252>
,不过这其中并没有告诉我们走进婚姻殿堂的情侣是如何认识的,不过如何找到异性的信息完全难不倒程序员小哥哥们,GITHUB上各种抓取交友信息的项目曾出不穷。

      最具创意项目:其中个人感觉最有创意的项目是抓取抖音上的头像信息,快速找到漂亮小姐姐的项目:
https://github.com/wangshub/Douyin-Bot <https://github.com/wangshub/Douyin-Bot>
,这个项目先利手机adb+爬虫技术获取抖音上的头像信息,再使用腾讯的人脸识别AI平台(可在
https://ai.qq.com/case/facedoor.shtml <https://ai.qq.com/case/facedoor.shtml>
申请),根据返回的年龄、魅力等数据进行来找到漂亮的小姐姐。其中人脸识别的部分代码截取如下:
class AiPlat(object): def __init__(self, app_id, app_key): self.app_id =
app_id self.app_key = app_key self.data = {} self.url_data = '' def
invoke(self, params): self.url_data =
urllib.parse.urlencode(params).encode("utf-8") req =
urllib.request.Request(self.url, self.url_data) try: rsp =
urllib.request.urlopen(req) str_rsp = rsp.read().decode('utf-8') dict_rsp =
json.loads(str_rsp) return dict_rsp except Exception as e: print(e) return
{'ret': -1} def face_detectface(self, image, mode): self.url = url_preffix +
'face/face_detectface' setParams(self.data, 'app_id', self.app_id)
setParams(self.data, 'app_key', self.app_key) setParams(self.data, 'mode',
mode) setParams(self.data, 'time_stamp', int(time.time())) setParams(self.data,
'nonce_str', int(time.time())) image_data = base64.b64encode(image)
setParams(self.data, 'image', image_data.decode("utf-8")) sign_str =
genSignString(self.data) setParams(self.data, 'sign', sign_str) return
self.invoke(self.data)
根据腾讯的文档说明https://ai.qq.com/doc/detectface.shtml
<https://ai.qq.com/doc/detectface.shtml>
,其的返回有如下检测值,这个作者就是根据性别、魅力、微笑等参数来找到高颜值小姐姐的:
3. 响应参数 参数名称 是否必选 数据类型 描述 ret 是 int 返回码; 0表示成功,非0表示出错 msg 是 string
返回信息;ret非0时表示出错时错误原因 data 是 object 返回数据;ret为0时有意义 + image_width 是 int 请求图片的宽度 +
image_height 是 int 请求图片的高度 + face_list 是 array 被检测出的人脸列表 + + face_id 是 string
人脸(Face)ID + + x 是 int 人脸框左上角x + + y 是 int 人脸框左上角y + + width 是 int 人脸框宽度 + +
height 是 int 人脸框高度 + + gender 是 int 性别 [0~100](越接近0越倾向为女性,越接近100越倾向为男性) + + age
是 int 年龄 [0~100] + + expression 是 int 微笑[0~100] (0-没有笑容,50-微笑,100-大笑) + +
beauty 是 int 魅力 [0~100] + + glass 是 int 是否有眼镜 [0, 1] + + pitch 是 int
上下偏移[-30,30] + + yaw 是 int 左右偏移[-30,30] + + roll 是 int 平面旋转[-180,180] + +
face_shape 是 object 人脸配准坐标
    最实用项目:https://github.com/bthust/dating_pie_info_crawler
<https://github.com/bthust/dating_pie_info_crawler>,只要使用将项目整体clone下来,就能抓取
http://bbs.szhome.com/ <http://bbs.szhome.com/>
的信息了,如果想抓取其它网站,需要将spider/szhome_spider.py中的start_urls改为新的网址,再根据实际情况修改此文件中的parse函数即可。
start_urls = ['http://bbs.szhome.com/330.html'] def parse(self, response): #
获取详情页的链接 detail_urls = response.xpath("//dl[@class='fix']/dd/a[not(@class) and
@target]/@href").extract() for url in detail_urls: if url.startswith("/330"):
url='http://bbs.szhome.com'+url print 'found more url:%s' % (url) if url in
SzhomeSpider.detail_url_set: pass else: SzhomeSpider.detail_url_set.add(url)
with open('szhome.url.txt', 'a') as record_file: record_file.write(url+'\n')
yield scrapy.Request(url,callback=self.parse) #yield
self.make_requests_from_url(url) else: pass # 获取其他列表页
list_urls=response.xpath("//div[@class='pages']/a[not(@class='next')]/@href").extract()
for url in list_urls: if url.startswith("/330"):
url='http://bbs.szhome.com'+url print 'found more url:%s' % (url) if url in
SzhomeSpider.list_url_set: pass else: SzhomeSpider.list_url_set.add(url) if
SzhomeSpider.crawl_list_pages<10: SzhomeSpider.crawl_list_pages+=1 yield
scrapy.Request(url,callback=self.parse) else: pass #处理详情页 if
response.url.find('detail')>=0: title = response.xpath("//div[contains(@class,
'post-content ps-r')]/h1") details=response.xpath("//div[contains(@class,
'post-content ps-r')]/div[@id='SubjectDetail']")
post_time=response.xpath("//span[@class='post-time spanWriteTime']/text()")
images=[] if len(title.extract())>0: daytime =
datetime.datetime.strptime(post_time.extract()[0], '%Y-%m-%d %H:%M:%S') #图片 -
表情 emojis=response.xpath("//div[contains(@class, 'post-content
ps-r')]/div[@id='SubjectDetail']/img") for emoji in emojis: #print 'find image:
%s' % (emoji.extract()) images.append(emoji.extract())
pie_images=response.xpath("//div[contains(@class, 'post-content
ps-r')]/div[@id='SubjectDetail']/a/img") for pie_image in pie_images: #print
'find image: %s' % (pie_image.extract()) images.append(pie_image.extract())
item=SzhomeItem() item['title']=title.extract()[0].replace('</h1>',
'').replace('<h1>', '') item['detail'] =details.extract()[0]
item['addr']=response.url item['images']=images item['daytime'] = daytime if
(not IMAGE_IS_MUST or len(pie_images)>0) and self.is_time_ok(daytime): yield
item else: print 'skip title=%s url=%s' % (item['title'], response.url)
      开源的相亲网站

       
 开源这个特性其实是非常针对程序员群体的,比如在我的印象中开源意味着容易使用,便于沟通,而对于我的老婆-一位非程序员来说,开源相亲网站给她的第一印象,是给LHBT群体提供同性交友服务的工具.....不知道这是不是普遍现象。

     PH7CMS:pH7 Social Dating CMS,源码地址在
https://github.com/pH7Software/pH7-Social-Dating-CMS
<https://github.com/pH7Software/pH7-Social-Dating-CMS>,网址地址在https://ph7cms.com/
<https://ph7cms.com/>,从整体来说这是一个中规中距的网站,效果如下,



   FindLover:这是一个访花田网的网站,源码地址在https://github.com/stoneniqiu/FindLover
<https://github.com/stoneniqiu/FindLover>,它基于Asp.Net MVC3 Bootstrap2
Juqery1.7.2,这个项目虽小但是五脏俱全,如果想学习网站的开发与搭建是个不错的选择。

         交友信息交换的项目

    GITHUB是个比较包容的平台,除了开源代码,你也可以把他看成一个信息发布的渠道,这里也有不少单纯发布交友信息的项目,目前星数比较高的是大确幸的
awesome-lover,网址在https://github.com/xixinjiejie/awesome-lover
<https://github.com/xixinjiejie/awesome-lover>
,这是一个聚焦在程序员相亲、恋爱的创业项目,所以直接把信息放在了GITHUB上(真会找地啊),单身的程序员们也可以关注。

 

 

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信