Advertisement
Guest User

Untitled

a guest
Jul 4th, 2023
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. from bs4 import BeautifulSoup, SoupStrainer
  2. import httplib2
  3. import requests
  4. import lxml
  5. import os
  6.  
  7. url = 'https://pastelink.net/2w1ne'
  8. http = httplib2.Http()
  9. response, content = http.request(url)
  10.  
  11. response = requests.get('https://pastelink.net/2w1ne')
  12. if response.status_code != 200:
  13.     print('Page not found')
  14.     exit(1)
  15.  
  16. print('Successfully fetched the page')
  17.  
  18. links = []
  19.  
  20. print('Scraping Links from ', url)
  21.  
  22. for link in BeautifulSoup(content, features="lxml").find_all('a', href=True, target="_blank"):
  23.     links.append(link['href'])
  24.    
  25. for link in links:
  26.     print(link)
  27.  
  28. input('Press ENTER to exit')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement