|
|
#1 |
|
Connoisseur
![]() ![]() Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
|
print#
What do you do when the article does not lead to a printable page you can look at but wants to actually print the page.
http://www.calgarysun.com/news/alber.../16301276.html http://www.calgarysun.com/news/alber...276.html#print |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
|
|
|
|
|
#3 |
|
Connoisseur
![]() ![]() Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
|
Ok I have another one
This does have a print version
http://www.mensfitness.com/fitness/b...t_training/806 http://www.mensfitness.com/fitness/b...ng/806?print=1 |
|
|
|
|
|
#4 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Connoisseur
![]() ![]() Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
|
Yes, Sorry.
What is the correct code to pull the print version ? Oh by the way I found some of your code that relates to turning hyperlinks in articles to plain text. Thanks. I was using a piece of code in extra css that removed all underlines from all links but left the background color. I like your way better. Last edited by mufc; 11-26-2010 at 02:33 PM. |
|
|
|
|
|
#6 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
It looks like you just add "?print=1" to the url.
Code:
def print_version(self, url):
return url + "?print=1"
Quote:
|
|
|
|
|
|
|
#7 |
|
Connoisseur
![]() ![]() Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
|
I had tried something similar without much success. This does not seem to work either.
http://www.mensfitness.com/rss_global/ This pages leads to main rss feed then when I link to an article it gives me print option but the code you gave me did not work unless I have done something wrong. class AdvancedUserRecipe1289709253(BasicNewsRecipe): title = u'test' oldest_article = 7 max_articles_per_feed = 100 use_embedded_content = False no_stylesheets = True remove_javascript = True extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }' feeds = (u'News', u'http://www.mensfitness.com/rss_global/') def preprocess_html(self, soup): for alink in soup.findAll('a'): if alink.string is not None: tstr = alink.string alink.replaceWith(tstr) return soup def print_version(self, url): return url + "?print=1" |
|
|
|
|
|
#8 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
If you want your code tested or looked over, you have to post inside CODE tags (the #symbol). Otherwise we can't see the indents.
Quote:
|
|
|
|
|
|
|
#9 |
|
Connoisseur
![]() ![]() Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
|
oK I did my own recipe for Macleans and this works.
Code:
class AdvancedUserRecipe1289709253(BasicNewsRecipe):
title = u'Macleans Magazine'
oldest_article = 7
max_articles_per_feed = 100
use_embedded_content = False
no_stylesheets = True
remove_javascript = True
extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }'
remove_tags_before = dict(id='')
remove_tags = [dict(name='div', attrs={'class':['wp-caption','']}),
dict(name='div', attrs={'id':['headerimg','footer',]}),
dict(name='ul', attrs={'class':['']}),
dict(name='ul', attrs={'id':['']}),
dict(name='ol', attrs={'id':['']}),
dict(name='span', attrs={'class':['']}),
dict(name='p', attrs={'class':'postmetadata'}),
dict(name='img'),]
feeds = [(u'Canada', u'http://www2.macleans.ca/category/canada/feed/')
]
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
def print_version(self, url):
return url + "print/"
Code:
class AdvancedUserRecipe1289709253(BasicNewsRecipe):
title = u'test'
oldest_article = 7
max_articles_per_feed = 100
use_embedded_content = False
no_stylesheets = True
remove_javascript = True
extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }'
feeds = (u'News', u'http://www.mensfitness.com/rss_global/')
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
def print_version(self, url):
return url + "?print=1"
I want to get the print option correct. Code:
class AdvancedUserRecipe1289709253(BasicNewsRecipe):
title = u'Mens Fitness'
oldest_article = 7
max_articles_per_feed = 100
use_embedded_content = False
no_stylesheets = True
remove_javascript = True
extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }'
keep_only_tags = [dict(name='div', attrs={'id':'content_items'})]
remove_attributes = ['style', '']
remove_tags_before = dict(id='')
remove_tags = [dict(name='div', attrs={'class':['','']}),
dict(name='div', attrs={'id':['','',]}),
dict(name='ul', attrs={'class':['']}),
dict(name='ul', attrs={'id':['']}),
dict(name='ol', attrs={'id':['']}),
dict(name='span', attrs={'class':['']}),
dict(name='p', attrs={'id':''}),
dict(name='img'),]
feeds = (u'News', u'http://www.mensfitness.com/rss_global/')
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
Last edited by mufc; 11-27-2010 at 12:11 PM. |
|
|
|
|
|
#10 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print vs Pixel: retailers experiment with print/ebook bundles | DMcCunney | General Discussions | 42 | 09-15-2010 12:29 PM |
| How to Print? | Lady Fitzgerald | Calibre | 10 | 05-14-2010 04:58 PM |
| iPad The iPad can not Print ??? | yvanleterrible | Apple Devices | 74 | 04-17-2010 04:13 PM |
| Do you print out PDFs? | Nate the great | Workshop | 13 | 02-18-2008 07:36 PM |
| Google Print | TadW | Lounge | 0 | 12-18-2003 08:35 PM |