Submit To Feedage


/ Published in: Python
Save to your folder(s)

Log in to feedage.com
Submit an rss feed
Print the results


Copy this code and paste it in your HTML
  1. # mechanize handles cookies, so we can actually log in
  2. import mechanize
  3.  
  4. USERNAME = ''
  5. PASSWORD = ''
  6. RSS_URL = ''
  7.  
  8. # Instantiate the mechanize browser
  9. br = mechanize.Browser()
  10.  
  11. # Add headers to make the "browser" look real
  12. br.addheaders = [("User-agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3"), ("HTTP_CONNECTION", "keep-alive"), ("HTTP_KEEP_ALIVE", "300"), ("HTTP_ACCEPT", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("HTTP_ACCEPT_CHARSET", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"), ("HTTP_ACCEPT_ENCODING", "gzip,deflate"), ("HTTP_ACCEPT_LANGUAGE", "en-us,en;q=0.5"), ("HTTP_USER_AGENT", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3")]
  13.  
  14. # We're not a robot
  15. br.set_handle_robots(False)
  16.  
  17. # Navigate to the login page
  18. br.open('''http://rss2.com/signin/''')
  19.  
  20. # Count the forms in the HTML, we want the 1st one
  21. br.select_form(nr=0)
  22.  
  23. # Fill in the form elements by name
  24. br["username"] = USERNAME
  25. br["password"] = PASSWORD
  26.  
  27. # Click the submit button
  28. login_response = br.submit()
  29.  
  30. # Read the login buffer, might want to actually do something with this
  31. buffer = login_response.read()
  32.  
  33. # Navigate to your user's page
  34. br.open('''http://rss2.com/users/%s''' % (USERNAME))
  35.  
  36. # Count the forms in the HTML, we want the 1st one
  37. br.select_form(nr=0)
  38.  
  39. # Fill in the form elements by name
  40. br["site_url"] = RSS_URL
  41.  
  42. # Click the submit button
  43. resp = br.submit()
  44.  
  45. # View the results after the click
  46. print resp.read()

URL: http://blackcodeseo.com/automating-rss-submissionautomating-rss-submission/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.