Pages

Monday, October 31, 2011

22

How to autopost to Blogpost from RSS

Autoposting from RSS feed(s) is a much asked feature in Blogger. I will tell you here one way to accomplish this without third party services. You'll need some computing skills, I won't explain everything in detail, details can be found in other documentation.

First of all, you need the RSS feed or feeds, where the articles appear that you want to republish. You can combine multiple feeds into one using Google Reader, if you wish: group feeds together in a folder and make folder feed public and shared. But you don't have to combine feeds, multiple feeds are ok as is.

Don't steal other people's work. Before publishing content written by other's, you should ask permission for it, otherwise your blog may be reported and terminated. But maybe you want to aggregate your own posts from many blogs to one blog. And this can be done from other/mixed environments, like Wordpress.com, too, and to a hidden blog (visible only to you). Not from hidden blogs, though, because you need the feed. If you republish your own material, that is ok of course.

Blog settings and setting up rss2email

In the blog you want to publish, go to Settings | Email & Mobile. Set your secret email posting address by providing a secret word. Choose "Save emails as draft posts". You can change that to "Publish emails immediately" after you have directed feed(s) to blog and have everything working.

Rss2email is a free tool for delivering news from RSS feeds to email. Python is needed to run rss2email. Rss2email can be run in Windows and different UNIX systems.

Download, install and configure rss2email. I had to change the outgoing mail server settings and the email address of sender (DEFAULT_FROM) in config.py. I also configured rss2email to use html (HTML_MAIL = 1) and not to use stylesheet (USE_CSS_STYLING = 0).

In unix console, change to rss2email's directory, and execute commands:

./r2e new YOURNAME.YOURSECRETWORDS@blogger.com
./r2e add http://yourfeedurl.com
./r2e add http://yoursecondfeedurl.com
./r2e add http://yourthirdfeedurl.com

In Windows you would run r2e.bat instead of ./r2e. You need at least one feed url. Now you have your feed(s) ready for sending to blog.

Sending old (current) entries or not?

If you want to start feeding your blog with only new entries in the feed(s), run first:

./r2e run --no-send

That marks all current feed entries read. Afterwards run ./r2e in regular basis, for example from crontab.

If you want to send all entries, run "r2e run" already at the first time. But beware, there is a limit of about 30-50 posts you can send to Blogger in one day. One way to limit the posts is to add one new feed per day for the publishing email.

You can also publish single posts from a feed using Google Reader. View a post from the feed, select Send To, Blogger.

Double titles hacked away

To prevent "double titles" (first article title, then title with a link to the source) in the receiving blog, I did the following changes to rss2email.py (version 2.71), first around line 717, search for:
      content += '<h1'
      content += ' class="header"'
      content += '><a href="'+link+'">'+subjecthdr+'</a></h1>\n'
Add # in front of all 3 lines:
#      content += '<h1'
#      content += ' class="header"'
#      content += '><a href="'+link+'">'+subjecthdr+'</a></h1>\n'
and around line 748, search lines:
        content = ("<html><body>\n\n" + 
                  '<h1><a href="'+link+'">'+subjecthdr+'</a></h1>\n\n' +
                  entrycontent[1].strip() + # drop type tag (HACK: bad abstraction)
                  '<p>URL: <a href="'+link+'">'+link+'</a>' )
Add # in front of one line, like this:
       content = ("<html><body>\n\n" + 
#                  '<h1><a href="'+link+'">'+subjecthdr+'</a></h1>\n\n' +
                  entrycontent[1].strip() + # drop type tag (HACK: bad abstraction)
                  '<p>URL: <a href="'+link+'">'+link+'</a></p>' )

If you have different version, then you might have to change something else. The purpose of the changes is to remove <h1> title+link from the beginning of the email body.

Run rss2email automatically

And finally I added a crontab entry (crontab -e) to run the script once an hour (33 minutes past full hour), like this:

33 * * * * cd ~/rss2email-2.71/ && ./r2e run

In Windows you would use the Windows task scheduler and run r2e.bat. See more instructions in rss2email/getting-started-with-rss2email.

I have also subscribed the feeds to my Google Reader, so I decided not to publish the emailed articles immediately, but as a draft. This way I can also do some minor adjustments to the article before publishing, or choose not to publish the article at all.
[Hide comments] - [Show comments]
Click on a single comment to hide/show its text

22 comments:

Unknown said... [reply]

Hello,
Yeah good one . This is really useful stuff for bloggers . I personally use one auto blog posting software from webtoolsin for posting rss contents to my blogs .
http://www.webtoolsin.com/products-2-auto-blogger.html

Unknown said... [reply]

What smtp did you used for blogger ?

MS-potilas said... [reply]

@Lucas I use one provided by my internet service provider.

Unknown said... [reply]

Hello thank you for the awesome program and may i ask or any solution why all embedded files like Youtube or Megavideo etc. are not showting up and how can i remove the Link below of the original post? thanks! im migrating my movie sites, regards

Unknown said... [reply]

@Lucas live.com email would be great just dont post a feeds more than 30 :P

# try this config if you have #live.com or other related

SMTP_SEND = 1

SMTP_SERVER = "smtp.live.com:587"
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
SMTP_USER = 'MYEMAIL@live.com' # for SMTP AUTH, set SMTP username here
SMTP_PASS = 'MyPassWord' # for SMTP AUTH, set SMTP password here

MS-potilas said... [reply]

@PinoyMedia
Hi,

I don't know why embedded videos don't work. Are they appearing in the feed(s) of the original sites? Unfortunately migrating sites often require much manual work, too.

You can remove the link by editing rss2email.py, there are three lines that contain "URL:" (without the quotes), find the first of them and comment the line out (keep the right indents) or delete the line. That should remove the url at the end of the post when default settings are used.

You can actually edit the rss2email.py even more to format the posts, etc, but then you'll have to know Python.

Hai Huynh said... [reply]

You can use "Post content from RSS to blogpost" tool it's free
Post content from RSS to blogpost

Anonymous said... [reply]

I like your way to use Google Reader to manage the blog posting. Unfortunately it was shutting down..

Afolabi said... [reply]

pls who can do this for me, i am not getting it.. or who can do a video tutorial for this and send it to afodapsy@gmail.com i will appreciate thanks.

jeeva said... [reply]

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa training in chennai
rpa interview questions and answers
automation anywhere interview questions and answers
blueprism interview questions and answers
uipath interview questions and answers
rpa training in chennai

afiah b said... [reply]

Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks
Java training in Pune

Java interview questions and answers

Java training in Chennai | Java training institute in Chennai | Java course in Chennai

Java training in Bangalore | Java training institute in Bangalore | Java course in Bangalore

Azure DevOps said... [reply]

It is really great work and the way in which you are sharing the knowledge is excellent.
RPA Online Training

nova driving school said... [reply]

I read your blog now share great information here. Dmv certified driving school

On Demand App Development Services said... [reply]

Nice blog!! Thanks for sharing this informative blog!

cloneapps said... [reply]

Want to build a single vendor or multi-vendor eCommerce store? Goappx Ecommerce clone app
can help you launch one with the hassle of coding and testing.

Unknown said... [reply]

I really liked this blog and it is very useful for us. Thank you so much for giving this information.
And also WE ARE A LEADING MOBILE APPLICATION DEVELOPMENT COMPANY. https://appicial.com/

Post a Comment

Related Posts Plugin for WordPress, Blogger...
See the hack
for this dynamic
views icon: