GithubHelp home page GithubHelp logo

Comments (3)

khanfarhan10 avatar khanfarhan10 commented on May 3, 2024

@Tishacy please look into this issue!

from scidownl.

khanfarhan10 avatar khanfarhan10 commented on May 3, 2024

Also returning the saved_filepath instead of None makes more sense while downloading the files

from scidownl.scihub import *

DOI = "10.1021/ol9910114"
out = 'paper'
sci = SciHub(DOI, out).download(choose_scihub_url_index=3)

from scidownl.

fridrichmrtn avatar fridrichmrtn commented on May 3, 2024

You can just use this hotfix>

from scidownl.scihub import *
class SciHub(SciHub):
    def __init__(self, doi, out='.', title=None):
        self.doi = doi
        self.out = out
        self.title = title
        self.sess = requests.Session()
        self.check_out_path()
        self.read_available_links()

    def find_pdf_in_html(self, html):
        pdf = {}
        soup = BeautifulSoup(html, 'html.parser') 
        pdf_url = soup.find('embed', {'id': 'pdf'}).attrs['src'].split('#')[0]
        pdf['pdf_url'] = pdf_url.replace('https', 'http') if 'http' in pdf_url else 'http:' + pdf_url
        #title = ' '.join(self._trim(soup.title.text.split('|')[1]).split('/')).split('.')[0]
        #title = title if title else pdf['pdf_url'].split('/')[-1].split('.pdf')[0]
        self.title = self.title if self.title else pdf['pdf_url'].split('/')[-1].split('.pdf')[0]
        pdf['title'] = self.check_title(self.title)
        print(STD_INFO + colored('PDF url', attrs=['bold']) + " -> \n\t%s" %(pdf['pdf_url']))
        print(STD_INFO + colored('Article title', attrs=['bold']) + " -> \n\t%s" %(pdf['title']))
        return pdf

Also fixed in this PR #16.

from scidownl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.