Jobs 数量地区分布图
# +------+-----------+
# | area | Job数量 |
# +------+-----------+
# | 1 | 424 | 北京
# | 2 | 291 | 上海
# | 3 | 73 | 广州
# | 4 | 46 | 深圳
# | 5 | 62 | 杭州
# | 6 | 45 | 成都
# | 7 | 39 | remote
# | 8 | 127 | others
# +------+-----------+
点赞最多的 Topic
https://ruby-china.org//topics/13680
给薄荷网赞一个!
下面是主要程序片段
desc "获取ruby-china.org上的工作"
task :get_jobs => :environment do
time_start = Time.now
Job.connection
(1..74).each do |_id|
url = "https://ruby-china.org/jobs?page=#{_id}"
doc = Nokogiri::HTML(open(url))
doc.xpath("//div[@class='topics']/div").each do |_line|
topic_class = _line['class']
right_info_path = "//div[@class='#{topic_class}']/div[@class='right-info']"
topic_path = right_info_path +"/div[@class='pull-right replies']/a"
# 获取点赞数量
up = doc.xpath(topic_path).text
up = 0 if up.empty?
# 获取标题
title_path = right_info_path + "/div[@class='infos']/div[@class='title']/a"
title = doc.xpath(title_path)[0]['title']
# 获取url
url_suffix = doc.xpath(title_path)[0]['href']
url = "https://ruby-china.org/#{url_suffix}"
area = cal_area(title)
job = Job.create!(title: title, area: area, up: up, url: url)
puts "#{title}"
end
end
time_end = Time.now
puts "rake 执行完毕!耗时#{ time_end - time_start }秒"
end
Top 20
mysql> select title, up, url from jobs order by up desc limit 20\G;
*************************** 1. row ***************************
title: [上海]薄荷科技寻找靠谱的 Rubyist
up: 125
url: https://ruby-china.org//topics/13680
*************************** 2. row ***************************
title: [广州] 招聘 Ruby 程序员【已结束】
up: 124
url: https://ruby-china.org//topics/14975
*************************** 3. row ***************************
title: [西安] 途途科技招聘 Ruby/Rails 工程师 / 实习生
up: 111
url: https://ruby-china.org//topics/18818
*************************** 4. row ***************************
title: [北京] 酷传招聘Ruby on Rails全职实习生/初级工程师,当然我们也喜欢高手
up: 106
url: https://ruby-china.org//topics/5112
*************************** 5. row ***************************
title: [上海][浦东][扩招]一名 Ruby 工程师(附靓照)【已结束】
up: 102
url: https://ruby-china.org//topics/12391
*************************** 6. row ***************************
title: [北京] 天际网寻觅初、中、高级 Rubyist [暂停招聘]
up: 95
url: https://ruby-china.org//topics/5745
*************************** 7. row ***************************
title: [南京]暴走漫画招聘 rails 程序员(内有无节操图,慎入)
up: 94
url: https://ruby-china.org//topics/12431
*************************** 8. row ***************************
title: [日本] 宣传下我现在就职的公司:日本COOKPAD
up: 90
url: https://ruby-china.org//topics/864
*************************** 9. row ***************************
title: [深圳] Knewone.com 招聘 Ruby/Javascript/iOS 程序员
up: 90
url: https://ruby-china.org//topics/11561
*************************** 10. row ***************************
title: [北京][上海][远程] Doorder 招聘 Ruby on Rails 高级开发工程师
up: 89
url: https://ruby-china.org//topics/19290
*************************** 11. row ***************************
title: [上海] 百度诚招高级研发工程师 Ruby
up: 89
url: https://ruby-china.org//topics/15393
*************************** 12. row ***************************
title: [北京] 招靠谱 Ruby 攻城狮
up: 83
url: https://ruby-china.org//topics/3867
*************************** 13. row ***************************
title: [上海] "英语流利说"诚聘 Rails 开发工程师
up: 80
url: https://ruby-china.org//topics/12746
*************************** 14. row ***************************
title: 此贴复活![杭州] 急招 Ruby 工程师,前端工程师,iOS,安卓,产品经理,月薪 10k-25k,办公地点可以自选.
up: 77
url: https://ruby-china.org//topics/15650
*************************** 15. row ***************************
title: [已结束][上海] 掌誉网络科技招聘靠谱Ruby程序员 - 你看了以后可能几天都睡不好觉的招聘帖
up: 76
url: https://ruby-china.org//topics/8893
*************************** 16. row ***************************
title: [深圳] KnewOne 招聘开发实习生(北京也招聘前后端开发)
up: 75
url: https://ruby-china.org//topics/17881
*************************** 17. row ***************************
title: [欧洲] Chinese speaker Ruby/JS/Web Developer - 招聘已结束
up: 75
url: https://ruby-china.org//topics/12750
*************************** 18. row ***************************
title: [杭州] The Plant 招人
up: 71
url: https://ruby-china.org//topics/2391
*************************** 19. row ***************************
title: [杭州滨江] 急招 Ruby 大神?高手?长者?
up: 68
url: https://ruby-china.org//topics/17351
*************************** 20. row ***************************
title: [广州] 招聘 Ruby / Rails 程序员
up: 67
url: https://ruby-china.org//topics/4337
20 rows in set (0.00 sec)
附加:PM2.5 对比
北京 vs 上海
北京 vs 广州
北京 vs 杭州
北京 vs 深圳
个人爱好,不喜勿喷。