Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Url Scraper - Regex

wu guys saw many times ppl that ask about it
so i made simple function \ example

Python 3
PHP Code

<?php 
import urllib
.request, re

def Url_Scraper
(url,reg):
    
src = urllib.request.urlopen(url).read()
    match = 
re.findall(reg, str(src))
    for 
m in match:
           print(
m)

Url_Scraper('http://www.google.com','\href="(.*?)"') 

🤝 Enjoy
What's with the rogue backslash in the 2nd param? \h isn't an escape character and I didn't know you could refer to string literals with just \ in python. I thought you would either just \Qstring literal here\E or just backslash the = and the "


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by zograJun 18, 2021 09:13 AM 4 128 Jun 18, 2021 09:13 AM
Last Post: zogra
[C#] by Bruce BannerOct 8, 2019 03:38 PM 5 433 Oct 8, 2019 03:38 PM
Last Post: Bruce Banner
[Python] by ExoticModzV1Aug 25, 2016 07:15 PM 1 115 Aug 25, 2016 07:15 PM
Last Post: The Ras Prosecutor