0
所以,我最近一直在用python冒險,而且我一直在嘗試通過混合我發現和創建的代碼來學習一些東西它將成爲我未來可能最終使用的東西。我已經幾乎完全的項目,雖然當我打印出來的鏈接,它說的是這樣的事情,我寧願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()
那麼你的_question_是什麼?請[編輯]您的帖子,以顯示您想要的問題本身。即使人們願意從某個隨機站點啓用JavaScript來找出你所問的(我不是),那麼在鏈接已經腐爛後,所得到的問答對任何人來說都是毫無價值的。 –
它顯示https://v3rmillion.net/showthread.php 當它只是應該只顯示https://v3rmillion.net/showthread.php?tid=393794 – Biologic
外部鏈接不好,mkay – JacobIRR