分享 爬虫获取 ruby-china 职位地区分布数量统计

ibugs · 2014年11月04日 · 最后由 mogodb 回复于 2014年11月17日 · 8308 次阅读
本帖已被管理员设置为精华贴

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 深圳

个人爱好,不喜勿喷。

哎,北京的朋友来深圳吧。。。深圳缺人。。。还没有雾霾,身体好,才是好

@badboy 北京的空气确实很差,其他倒是挺好的。

赞下 remote~最大的梦想就是回到家乡的三线城市 remote

@gsky remote 要想好了,一但离开,变再也回不到之前的状态。人是社会的人,还是要和别人多交流,多参与各种活动的。当然,每个人有自己的选择,没有对错之分,remote 也不错哦。

WH,你最近是不是工单太少了,我联系 wangqian 给你多安排点啊。。

Don't know how to build task 'environment'

第一次用 rake 的路过

深圳空气有这么好!

你这个号 留着之后要用上的 到时候借鉴一下啊

天啊。。。北京如果每天都开会就好了。。。 北京的空气 http://www.tianqi.com/air/beijing.html

深圳的空气 http://www.tianqi.com/air/shenzhen.html

#2 楼 @ibugs 酷炫!这个招聘贴是一年多前的了,我们刚刚已经搬了办公地方,不过招聘牛人一直在继续,新的办公室也极有特色,哈!

PM2.5 对比 ...... 这个不错哦

可以啊。wh。哈哈

14 楼 已删除
16 楼 已删除
17 楼 已删除

@vincent 环境挺赞的,天时地利与人和,不错!

很好 我们还在前几名呢 哈哈哈

这两天精华贴不少~

统计图用脑啥软件绘制的?

#22 楼 @mogodb extjs 绘制的图案,从网上找的呢,查看这里 http://aqistudy.sinaapp.com/

#23 楼 @ibugs aqistudy 这个站你做的?

@mogodb 不是呢,之前用 java 搭配 extjs 做过类似的软件,但是这个是别人做的。

#25 楼 @ibugs 现在不搞 java,只搞 ruby 了么?

看来西安还在 others 里 还木有 remote 多啊

@mogodb 两手抓,两手都要硬,呵呵

#28 楼 @ibugs 主要搞哪个?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号