Skip to content

Samair#2

Merged
pgaref merged 4 commits intopgaref:masterfrom
ieguiguren:samair
Jul 13, 2016
Merged

Samair#2
pgaref merged 4 commits intopgaref:masterfrom
ieguiguren:samair

Conversation

@ieguiguren
Copy link
Copy Markdown
Contributor

Added samari.ru to be parsed

@pgaref
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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