commit
99700532d9
|
@ -1,6 +1,8 @@
|
|||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from gitenberg.metadata.pandata import Pandata
|
||||
|
||||
from regluit.core.bookloader import add_from_bookdatas, BasePandataLoader
|
||||
|
|
|
@ -67,13 +67,14 @@ class SpringerScraper(BaseScraper):
|
|||
|
||||
def get_title(self):
|
||||
el = self.doc.select_one('#book-title')
|
||||
value = ''
|
||||
if el:
|
||||
value = el.text.strip()
|
||||
if value:
|
||||
value = value.replace('\n', ': ', 1)
|
||||
self.set('title', value)
|
||||
if not value:
|
||||
(SpringerScraper, self).get_title()
|
||||
super(SpringerScraper, self).get_title()
|
||||
|
||||
def get_role(self):
|
||||
if self.doc.select_one('#editors'):
|
||||
|
@ -109,7 +110,7 @@ class SpringerScraper(BaseScraper):
|
|||
@classmethod
|
||||
def can_scrape(cls, url):
|
||||
''' return True if the class can scrape the URL '''
|
||||
return url.find('10.1007') or url.find('10.1057')
|
||||
return url.find('10.1007') >= 0 or url.find('10.1057') >= 0
|
||||
|
||||
|
||||
search_url = 'https://link.springer.com/search/page/{}?facet-content-type=%22Book%22&package=openaccess'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from regluit.core.bookloader import add_by_sitemap
|
||||
from regluit.core.loaders import add_by_sitemap
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "load books based on a website sitemap"
|
||||
|
|
|
@ -164,15 +164,6 @@ class PageTests(TestCase):
|
|||
r = anon_client.get("/free/epub/gfdl/")
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
def test_static(self):
|
||||
# not logged in
|
||||
anon_client = Client()
|
||||
r = anon_client.get("/static/js/sitewide1.js")
|
||||
self.assertEqual(r.status_code, 200)
|
||||
r = anon_client.get("/static/scss/pledge.css")
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
class GoogleBooksTest(TestCase):
|
||||
fixtures = ['initial_data.json', 'neuromancer.json']
|
||||
def test_googlebooks_id(self):
|
||||
|
|
Loading…
Reference in New Issue