'Why does Python output an empty list when it should have output a list of URLs?
I ran the script below to grab text from a Pastebin text file and turn it into a list. Unfortunately, it's printing an empty list. Can anyone help me diagnose why this is the case? Thank you!
Command typed:
script.py -id 049YJMdV
Script
import requests, re, argparse
parser = argparse.ArgumentParser()
parser.add_argument('-id','--id', required=False)
args = vars(parser.parse_args())
id = args['id']
link = "https://web.archive.org/web/20150611011149/http://pastebin.com/raw.php?i={}".format(id)
data = []
links = requests.get(link).text
urls = re.findall(r'https?://[^\s<>"]+[|www\.^\s<>"]+', links)
print(data)
Output
[]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
