所以,我最近一直在四处冒险使用Python,我一直在试图通过混合代码,我找到并使它成为东西我可能最终使用在未来的学习一点东西。 我已经几乎完全的项目,虽然当我打印出来的链接,它说
https://v3rmillion.net/showthread.php
取而代之的是类似的东西我宁愿之中:
https://v3rmillion.net/showthread.php?tid=393794
import requests,os,urllib,sys, webbrowser, bs4
from bs4 import BeautifulSoup
def startup():
os.system('cls')
print('Discord To Profile')
user = raw_input('Discord Tag: ')
r = requests.get('https://www.google.ca/search?source=hp&q=' + user + ' site:v3rmillion.net')
soup = BeautifulSoup(r.text, "html.parser")
print soup.find('div',{'id':'resultStats'}).text
#This part below is where I'm having the issue.
content=r.content.decode('UTF-8','replace')
links=[]
while '<h3 class="r">' in content:
content=content.split('<h3 class="r">', 1)[1]
split_content=content.split('</h3>', 1)
link='http'+split_content[1].split(':http',1)[1].split('%',1)[0]
links.append(link)
#content=split_content[1]
for link in links[:5]:
print(link)
startup()