I'm testing the following script:
import re
import requests
from bs4 import BeautifulSoup
import os
import fileinput
Link = 'https://en.wikipedia.org/wiki/Category:1990'
q = requests.get(Link)
soup = BeautifulSoup(q.text)
#print soup
subtitles = soup.findAll('div',{'class':'links'})
#print subtitles
with open("Anilinks.txt", "w") as f:
for link in subtitles:
x = link.find_all('a', limit=26)
for a in x:
url = a['href']
f.write(url+'
')
I'm trying to get each link copied/pasted to a text file. The script seems like it should work, but it doesn't actually do anything.
How can I get this working?
See Question&Answers more detail:os