A good social presence is important for any successful blogger. But running a full time blog and keeping up your tweet volume is incredibly time consuming. It would be so much more convenient if you could set up bulk tweets for all your posts. Recently as I was doing some reCaptcha automation, I came up with an idea to use the iMacros browser plugin to automate just such a task. Here’s how I did it…
Let’s say in your blog you have a social bookmarks bar for each single post. The bar might look like this:
My idea is to automate clicking each of blog post’s tweet buttons to submit it (title + link) to your twitter micro blog. Social network bars may differ and so I’ll walk you through how to compose a macro that fits your particular blog’s social bookmarks bar.
What particullary do we want to automate for each blog page
- Click the social bar tweet button that will invoke a twitter page in a new tab or popup window with a filled-in form:
- Inside the form press Tweet button to tweet the chosen post (including its description and link).
So, let’s start.
Create a raw macro for your particular bar
Prerequisites
- Be logged in into your Twitter account.
- Install the iMacros extension for your browser and activate it (follow these steps if you’ve new to it). I’ve used one for FireFox.
Recording
Now, with iMacros installed and activated, you need to record your manual actions as to (1) open any blog post, (2) click tweet button of a toolbar => a new tab will open with the filled-in form.
(3) Press Tweet button to actually post it to Twitter.
Again, bookmark bars may differ, but all of them lead to the Twitter’s page at a new tab with fill-in form with call to action.
[box style=”light-grey note”]Note: If instead of a new tab a popup with twitter form appears you need to correct your browser settings. In Firefox go to about:config, search there for the preference: browser.link.open_newwindow.restriction and set it to 0 (zero); double-click on it to edit it.[/box]
Now your raw macro is ready and it’ll look something like this:
VERSION BUILD=8920555 TAB T=1 URL GOTO=http://scraping.pro/software-for-web-scraping/ FRAME F=5 TAG POS=1 TYPE=SPAN ATTR=ID:l TAB T=2 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:update-form ATTR=*
Macro analysis
The post url has been opened in the 1st tab:
TAB T=1
The frame with social bar is of number 5 (5th iframe tag in DOM of loaded HTML). The number might differ for different social bars, you’ll need to fetch it and insert it into a final macro:
FRAME F=5
Twitter page with form for submit has been opened in the 2nd tab. Might be opened in the same tab, no problem:
TAB T=2
Working macro
Now skipping a few details, I present you the final working macro that can run on a file with blog post URLs. Each loop fetches one URL at a time, visits that page and performs the actions that I recorded above. Do not forget to replace in Frame F=5 with your actual frame number!
VERSION BUILD=8920555 TAB CLOSEALLOTHERS SET !ERRORIGNORE YES TAB T=1 ' CSV = Comma Separated Values in each line of the file SET !DATASOURCE post_urls.csv ' Start at line 1 SET !LOOP 1 ' Increase the current position in the file with each loop SET !DATASOURCE_LINE {{!LOOP}} URL GOTO={{!COL1}} SET !TIMEOUT_STEP 1 FRAME F=5 TAG POS=1 TYPE=SPAN ATTR=ID:l SET !TIMEOUT_STEP 1 TAB T=2 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:update-form ATTR=*
To run macro for the all the lines in your urls file you need to press Run (Loop) button setting the max loops value that corresponds your urls amount:
Notes on the macro:
To ignore errors for any particular loop step we’ve added
SET !ERRORIGNORE YES
Since social media bars might be slow to load we’ve added timeout directives with time in seconds (increase number in seconds as appropriate in your case)
SET !TIMEOUT_STEP 1
You might use another timing directive instead in case the previous one does not function properly for your social bar.
WAIT SECONDS=1.5
File name is: post_urls.csv
SET !DATASOURCE post_urls.csv
Store this file with all the posts’ URLs it in the DATASOURCE directory. Where? At the iMacros side panel, at Manage tab press Settings button and in popped up Settings window choose Paths tab to see the path to the DATASOURCE directory.
How to grab all blog post URLs
There are many ways to automatically collect your blog post’s URLs, I recommend any of these simple ones:
- Use sitemap.xml file to get the links to the posts. It’s not always easy to parse though.
- Leverage free OutWit Hub software scraper upon google search results of your site (see a video with an example).
- Use Scraper, the Google Chrome Ext upon google search results.
- Install Scraper, google Chome ext. and make it active in the browser.
- Make a Google Chrome search for all the blogs’ content: site:<blogname>. You might add minus words to exclude service blog resources. ex.: -index, -tag, -img etc.
- On browser search results page select and Right-click on any given blog page link.
- Choose Scrape similar to invoke the Scraper extension.
- Now from the Scraper you export links into Google Spreadsheet (see the bottom-right corner button).
- In Google Sheets download file as CSV: Menu File -> Download as -> Comma-separated values (.csv)
I hope this tutorial is clear and helps you to make successful tweeting for your followers as well as for a blog SEO benefit.