예제 #1
0
def calcio2():
    ##return a list of links
    url2 = ops('aHR0cDovLzE3Mi42Ny4yMDkuMjM1Lw==').decode("utf-8")
    links = []
    headers = {
        'Host':
        ops('ZGFkZHlsaXZlLmNsdWI=').decode("utf-8"),
        'User-Agent':
        'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
    }
    req = requests.get(url2, headers=headers).text
    soup = BeautifulSoup(
        req, 'html.parser')  ##div class="col-lg-3 col-md-4 col-xs-4 mb-30"
    for i in soup.findAll("article", class_="col-xs-12"):
        ##links
        link = str((i.findAll('p'))[0])  ##only soccer
        regex = r'>(.*?)\<\/span\>'
        link = re.findall(regex, link)
        for i in link:
            i = i.replace('<br/>', '')
            i = re.findall('^(.*?)>', i)
            i = str(i)
            i = i.replace('<a href=',
                          ': ').replace('"',
                                        '').replace('[\'',
                                                    '').replace('\']', '')
            i = i.replace('/stream/', '/embed/')
            links.append(i)

    return links
예제 #2
0
파일: taybook.py 프로젝트: piopy/pio-bot
def testpage(author):
    author=author.replace(' ','-').lower()
    base_url = "aHR0cHM6Ly9kd25sZy50ZWwvYm9vay1uLw=="
    author = author.rstrip()
    try:
        new_url = ops(base_url).decode("utf-8") + author + "/"
        a=urllib.request.urlopen(new_url)
        a.getcode()
        return True
    except urllib.error.HTTPError as e:
        return False
예제 #3
0
def calcio():

    url2 = ops('aHR0cDovLzE3Mi42Ny4xODguMTc1L3Byb2cudHh0').decode("utf-8")
    headers = {
        'Host':
        ops('c3BvcnR6b25saW5lLnRv').decode("utf-8"),
        'User-Agent':
        'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
    }
    html = requests.get(url2, headers=headers).text
    html = html.splitlines()
    links = []
    lan = []
    for line in html:
        if 'HD' in line or 'BR' in line:
            lan += [line]
        if 'http' in line:
            if not '24/7 CHANNELS' in line: line = updategmt(line)
            links += [line]
    return links, lan
예제 #4
0
파일: taybook.py 프로젝트: piopy/pio-bot
def retrive_books(authors, bformat="pdf"):
    reg_ex_interno = r'a href="\/book-n[^>]+>([^<]+)'
    if bformat == "mobi": reg_ex_books = r'>([^\.]+\.mobi)<\/a>'
    elif bformat == "pdf": reg_ex_books = r'>([^\.]+\.pdf)<\/a>'
    else: reg_ex_books = r'>([^\.]+\.epub)<\/a>'
    base_url = "aHR0cHM6Ly9kd25sZy50ZWwvYm9vay1uLw==" #b64 to evoid being triggered by target searches
    downloaded_titles = []
    for author in authors: 
        if 1:
            author = author.rstrip()
            new_url = ops(base_url).decode("utf-8") + author + "/"
            print("\nWorking on " + author)
            req = urllib.request.Request(new_url)
            resp = urllib.request.urlopen(req)
            respData = resp.read()
            
            books = re.findall(reg_ex_interno, str(respData))
            responso=[]
            for book in books:
                if "Directory" not in book:
                    print("Processing book " + book)
                    url_download_book = new_url + book + "/"
                    req = urllib.request.Request(url_download_book)
                    resp = urllib.request.urlopen(req)
                    respData = resp.read()
                    titles = re.findall(reg_ex_books, str(respData))
                    for title in titles:
                        download_url = url_download_book + title
                        filename = author.replace("-", " ") + " - " + title.replace("-", " ")
                        if 1:
                            filename = author.replace("-", " ") + " - " + title.replace("-", " ").replace(".pdf",'')
                            #strin="Download "+filename+": "+url_download_book
                            strin="Download "+filename+": \n"+download_url+"\n\n"+download_url.replace(".pdf",".epub")+"\n\n"+download_url.replace(".pdf",".mobi")
                            responso.append(strin)
                        else:
                            print("Something bad happened :/")
    return responso
예제 #5
0
def encodecode(stringa):
    dec = ops(stringa).decode("utf-8")
    enc = ops(stringa).encode()
    return 'E: ' + enc + '\n\nD: ' + dec
예제 #6
0
import requests, time, random
from bs4 import BeautifulSoup

from base64 import b64decode as ops

dec = ops('aHR0cHM6Ly9pdC4xbGliLmV1').decode("utf-8")


def scrapedeep(url):
    req = requests.get(url).text
    soup = BeautifulSoup(req, 'html.parser')
    i = soup.find('a', class_="btn btn-primary dlButton addDownloadedBook")
    i = dec + i.get('href')
    return i


def scrapeResults(url):
    #prende l'url e vede i vari risultati, li apre e prende i collegamenti diretti
    #div id searchResultBox
    req = requests.get(url).text
    results = []
    soup = BeautifulSoup(req, 'html.parser')
    for i in soup.find_all("div",
                           class_="resItemBox resItemBoxBooks exactMatch"):
        r = random.randint(1, 13) / 10
        time.sleep(r)
        try:
            it = i.find('h3')
            it = it.find('a')
            link = dec + it.get('href')
            nome = it.get_text()
예제 #7
0
def dump(authors, sleep_time=2, bformat="epub"):
    reg_ex_interno = r'a href="\/book-n[^>]+>([^<]+)'
    if bformat == "mobi": reg_ex_books = r'>([^\.]+\.mobi)<\/a>'
    elif bformat == "pdf": reg_ex_books = r'>([^\.]+\.pdf)<\/a>'
    else: reg_ex_books = r'>([^\.]+\.epub)<\/a>'
    base_url = "aHR0cHM6Ly9kd25sZy50ZWwvYm9vay1uLw=="  #b64 to evoid being triggered by target searches

    try:
        for author in authors:
            try:
                author = author.rstrip()
                new_url = ops(base_url).decode("utf-8") + author + "/"
                print("\nWorking on " + author)

                req = urllib.request.Request(new_url)
                resp = urllib.request.urlopen(req)
                respData = resp.read()

                print("Downloaded author page")
                cartella = './d/' + author + '/'
                choice = "y"
                if not os.path.isdir(cartella):
                    os.mkdir(cartella)
                else:
                    choice = input(
                        "La cartella esiste già. Vuoi riscaricare questo autore? y/n: "
                    )
                if choice == "y":
                    books = re.findall(reg_ex_interno, str(respData))
                    print("Verranno scaricati:")
                    for b in books:
                        print(b)
                    c = input("Press enter to continue, type 0 to abort: ")
                    if c == '0':
                        break
                    for book in books:
                        if "Directory" not in book:
                            print("Progessing book " + book)
                            url_download_book = new_url + book + "/"
                            req = urllib.request.Request(url_download_book)
                            resp = urllib.request.urlopen(req)
                            respData = resp.read()

                            titles = re.findall(reg_ex_books, str(respData))

                            for title in titles:
                                download_url = url_download_book + title
                                filename = author.replace(
                                    "-", " ") + " - " + title.replace(
                                        "-", " ")
                                try:
                                    req = urllib.request.Request(
                                        download_url,
                                        data=None,
                                        headers={
                                            'User-Agent':
                                            'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
                                        })
                                    definitive_filename = filename.title()
                                    definitive_filename = definitive_filename.replace(
                                        "Epub", "epub")

                                    out_file = open(
                                        os.path.join(cartella,
                                                     definitive_filename),
                                        'wb')
                                    with urllib.request.urlopen(
                                            download_url) as response:
                                        print(
                                            "==============================================================="
                                        )
                                        print("Downloading! " +
                                              definitive_filename)
                                        print(
                                            "==============================================================="
                                        )
                                        data = response.read(
                                        )  # a `bytes` object
                                        out_file.write(data)
                                    print("Sleeping for " + str(sleep_time) +
                                          " seconds\n")
                                    time.sleep(sleep_time)
                                except:
                                    print("Something bad happened :/")

            except:
                print(
                    "Something Happened, I don't know what and I don't give a f**k about. If u didn't select 'epub', try to do it now"
                )
        print(
            "===============================================================\n\n\n\n\n"
        )
        run()
    except KeyboardInterrupt:
        exit(0)