简体   繁体   English

HTTParty没有返回LinkedIn页面

[英]HTTParty not returning LinkedIn page

I'm trying to grab someone's full name off their LinkedIn profile using HTTParty and Nokogiri. 我正在尝试使用HTTParty和Nokogiri从某人的LinkedIn个人资料中获取某人的全名。 For some reason, HTTParty is not returning the actual LinkedIn HTML page. 由于某些原因,HTTParty不会返回实际的LinkedIn HTML页面。 It's something completely different (see my terminal output). 完全不同(请参阅我的终端输出)。 I tried this code with other URLs and it works fine. 我用其他URL尝试了此代码,并且工作正常。 Any ideas? 有任何想法吗?

Here's my code: 这是我的代码:

# Store the LinkedIn URL form command line.
linkedin_url = "https://www.linkedin.com/in/janedoe"

# Get the contents of the LinkedIn page.
page = HTTParty.get(linkedin_url)

p page.parsed_response

在此处输入图片说明

EDIT: Turns out, the HTML page I'm getting back just contains a script that creates a redirect -- any suggestions on how I can reach the final page? 编辑:原来,我要返回的HTML页面仅包含创建重定向的脚本-关于如何到达最终页面的任何建议?

That is the page. 那是页面。 It is HTML, and it performs a redirect to another page. 它是HTML,它执行重定向到另一个页面。 Go to the specified link in your browser, and see if it redirects. 转到浏览器中的指定链接,然后查看它是否重定向。 If it does, use the link your given URL redirects to. 如果是这样,请使用给定URL重定向到的链接。 That will also be HTML. 那也将是HTML。 If you need help parsing your HTML, DON'T USE REGEX . 如果您需要解析HTML的帮助,请不要使用REGEX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM