Example #1
0
def search_book(query,limit):

    allbook=[]
    i=1
    url='https://b-ok.cc/s/'+query

    source=requests.get(url,headers=headers)

    soup=bs(source.text,'html.parser')
    if(soup.find_all('h3',itemprop="name")):

        for result,type in zip(soup.find_all('h3',itemprop="name"),soup.find_all('div',class_="bookProperty property__file")):
            if(i==limit):
                break

            else:
                name=result.text.replace('\n','')
                print(i,name+type.text)
                print()
                i+=1
                allbook.append(result.a.get('href'))


        ch=int(input("Select a book "))

        print("Hold on tight getting your link ..............................")


        url='https://b-ok.cc/'+allbook[ch-1]

        get_book(url)
    else:
        print("No book found...")
        menu()
Example #2
0
def solidtorrent_search(query):
    '''
        search on solid torrent for long result(upto 20) and print magnet link of torrent and also copy it to clipboard
    '''

    url = 'https://solidtorrents.net/search?q=' + query
    #print(url)

    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2840.71 Safari/539.36'
    }
    source = requests.get(url, headers=headers)

    soup = bs(source.text, 'html.parser')

    result = soup.find_all(
        'h3', class_='subtitle-2 text-truncate')  #name of all torrents (20)

    size = soup.find_all('strong')  #find size of torrent
    seeders = soup.find_all('span',
                            class_="green--text darken-4 font-weight-bold")
    leechers = soup.find_all("span",
                             class_="red--text darken-4 font-weight-bold")

    magnet = soup.find_all('a')  #for find href links

    magnet_links = []  #list for storing magnet links

    i = 1
    for r, s in zip(result, size):
        print(
            i, r.text + "\nsize=" + s.text + " | seeders=" + sd.text.rstrip() +
            "| leechers=" + l.text.replace("\n", ""))
        i += 1

    for link in magnet:
        b = link.get('href')
        if re.match("^magnet:", b):
            magnet_links.append(b)

    print("Select a torrent")
    ch = int(input())

    print(magnet_links[ch - 1])

    print("\nHere is your magnet link for the torrent \n")
    pc.copy(str(magnet_links[ch - 1]))

    print(
        "\nWe make your work more easy\nYour magnet link is now in your clipboard\nGo to seedr.cc or open Torrent Downloader application and paste the link your download will start."
    )

    print("\nThanks for using Torrent Finder \nCreated with " + "\u2764" +
          " by Rishabh Sharma")

    search.menu()
Example #3
0
def get_book(url):

    source=requests.get(url,headers=headers)
    soup=bs(source.text,'html.parser')
    dl=soup.find('a',class_="btn btn-primary dlButton addDownloadedBook")
    l="https://b-ok.cc"+dl.get('href')

    print("Here is your direct download link: ",l)
    print("try to opening it in your default web browser...............")
    wb.open_new_tab(l)
    print()
    print("\nThanks for using\nCreated with " + "\u2764"+ " by Rishabh Sharma")
    menu()
Example #4
0
def t1337x_search(query):
    '''
    Search for torrents and return results if find anything and print no result were found and start process again
    '''

    url='https://1337x.to/search/'+query+'/1/'
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2840.71 Safari/539.36'}
    source=requests.get(url,headers=headers)

    soup=bs(source.text,'html.parser')

    if(soup.find_all('td',class_='coll-1 name')): #check if it return null or something ( case of wrong serach query)
        results=soup.find_all('td',class_='coll-1 name')
        size=soup.find_all('td',class_="coll-4 size mob-vip")
        search_result(soup,results,size) #call for getting results

    else:
        print("No results were returned. Please refine your search.")
        search.menu() #start program again
Example #5
0
def getTorrent(ch_url):
    '''
    return magnet link of desired torrent which user select
    '''
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2840.71 Safari/539.36'}
    source=requests.get(ch_url,headers=headers)
    soup=bs(source.text,'html.parser')
    magnet=soup.find_all('a')

    #searching for magnet link

    for link in magnet:

        b=link.get('href')
        if re.match("^magnet:",b):
            magnet_link=b
            break
    print("\nHere is your magnet link for the torrent \n")
    print(magnet_link)
    pc.copy(str(magnet_link))
    print ("\nWe make your work more easy\nYour magnet link is now in your clipboard\nGo to seedr.cc or open Torrent Downloader application and paste the link your download will start.")
    print("\nThanks for using Torrent Finder \nCreated with " + "\u2764"+ " by Rishabh Sharma")
    search.menu()