登录详情: usrname:life@tech69.com pwd:shiva @ 123
在使用上述凭据打开页面时,我们可以获得类似的信息 联系方式 0770228XXXX
但是,如果在url末尾添加?srn = true,则会提供以下信息 (https://www.gumtree.com/p/sofas/dfs-couches.-two-3-seaters.-one-teal-and-one-green.-pink-storage-footrest.-less-than-2-years-old.-/1265932994?srn=true)
联系方式 07702287887
我使用的代码如下:
import requests
from bs4 import BeautifulSoup
s = requests.session()
login_data = dict(email='life@tech69.com', password='shiva@123')
s.post('https://my.gumtree.com/login', data=login_data)
r = s.get('https://www.gumtree.com/p/sofas/dfs-couches.-two-3-seaters.-one-teal-and-one-green.-pink-storage-footrest.-less-than-2-years-old.-/1265932994?srn=true')
soup = BeautifulSoup(r.content, 'lxml')
y = soup.find('strong' , 'txt-large txt-emphasis form-row-label').text
print str(y)
但是上面的python代码仍然给出了部分信息 0770228XXXX 如何使用python代码获取完整信息。