0
点赞
收藏
分享

微信扫一扫

HTTParty库数据抓取代码示例

HTTParty库数据抓取代码示例_get方法

使用HTTParty库的网络爬虫程序,

require 'httparty'

# 设置服务器
proxy_host = ''
proxy_port = 

# 使用HTTParty库发送HTTP请求获取网页内容
response = HTTParty.get('/', :proxy => { :host => proxy_host, :port => proxy_port })

# 打印获取的网页内容
puts response.body

以上代码首先设置了地址和端口,然后使用HTTParty库的get方法发送HTTP请求。

举报

相关推荐

0 条评论