Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samair #2

Merged
merged 4 commits into from
Jul 13, 2016
Merged

Samair #2

merged 4 commits into from
Jul 13, 2016

Conversation

ieguiguren
Copy link
Contributor

Added samari.ru to be parsed

@pgaref
Copy link
Owner

pgaref commented Jul 13, 2016

Thanks for the PR! I like the css parsing step but there seem to be two different styles currently in the proxy page - the first one is causing parser failure:

  • link rel="stylesheet" href="/styles.css" type="text/css" media="screen"
  • link rel="stylesheet" href="/styles/b2c37.css" type="text/css" media="screen"

PS: Some proper exception handling could help in such cases. As a step further you could also take a look at issue #4 if you are interested.

Cheers,
Panagiotis

@ieguiguren
Copy link
Contributor Author

I've improved the extraction of the css link so, if order or page is changed, it'll still work:

  •     for href in soup.findAll('link'):
    
  •         if '/styles/' in href.get('href'):
    
  •            style = "http://www.samair.ru" + href.get('href')
    
  •            break
    
  •     css = requests.get(style).content.split('\n')
    

@pgaref
Copy link
Owner

pgaref commented Jul 13, 2016

Looks good, thanks!

@pgaref pgaref merged commit 9cc1278 into pgaref:master Jul 13, 2016
@ieguiguren ieguiguren deleted the samair branch July 15, 2016 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants