Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
make an RSS feed of Sinfest http://bin.piorkowski.ca/sinfest-rss/
On 2, uses urllib2 as before. On 3, requires requests to avoid effort figuring out new urllib. Write to file ourselves to ensure consistency in having file end in EOL between Python 2 and 3, though it doesn't /really/ matter.
Latest commit f9d9b09
Oct 9, 2015
|Failed to load latest commit information.|
Scrapes http://sinfest.net/ and creates an RSS feed of one item: the most recent comic. Intended for use with RSS readers that update daily or more frequently, as the RSS feed will not include comics older than the most recent one. Use cron or similar to invoke the scraper daily. Example crontab entry to run at 1 a.m. server time: # Run nightly 0 1 * * * cd /home/qviri/bin.piorkowski.ca/sinfest-rss/ && python scrape.py Tested on Python 2.7.10 and Python 3.4.3. On Python 2 uses built-in urllib2. On Python 3 requires the third-party requests library. With small modifications (having scrape.py print feed.format_rss2_string() rather than writing it to file rss2.xml) it would also be possible to re-scrape sinfest every time RSS feed is checked, but this would be at the expense of higher load on Sinfest's server and yours. feedformatter.py from http://code.google.com/p/feedformatter/ license for feedformatter.py: # Copyright (c) 2009, Luke Maurits <email@example.com> # All rights reserved. # With contributions from: # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE.