From 6ee0248392d73e2498811744508d85e748457ef0 Mon Sep 17 00:00:00 2001 From: 0x80 <0x80@negativezero.link> Date: Mon, 29 Nov 2021 00:00:00 +0000 Subject: [PATCH] Publish old rsstube Bash code. --- CHANGELOG | 126 +++++ LICENSE | 676 ++++++++++++++++++++++++ README.md | 118 +++++ conf/tor-browser-header | 10 + docs/sites.md | 193 +++++++ docs/version | 1 + install | 70 +++ rsstube | 187 +++++++ rsstube.1 | 85 +++ scripts/determine_site | 113 ++++ scripts/determine_software | 63 +++ scripts/http_errors | 89 ++++ scripts/options | 129 +++++ scripts/page-extractors/apple_podcasts | 6 + scripts/page-extractors/castro_fm | 1 + scripts/page-extractors/chirbit | 7 + scripts/page-extractors/fyyd | 1 + scripts/page-extractors/google_podcasts | 1 + scripts/page-extractors/invidious | 11 + scripts/page-extractors/mastodon | 26 + scripts/page-extractors/player_fm | 1 + scripts/page-extractors/pleroma | 25 + scripts/page-extractors/plume | 19 + scripts/page-extractors/pocketcasts | 1 + scripts/page-extractors/soundcloud | 7 + scripts/page-extractors/vimeo | 20 + scripts/page-extractors/writefreely | 21 + scripts/page-extractors/youtube | 19 + scripts/update | 12 + scripts/url-extractors/chirbit | 16 + scripts/url-extractors/deviantart | 11 + scripts/url-extractors/hugo | 7 + scripts/url-extractors/invidious | 39 ++ scripts/url-extractors/nitter | 16 + scripts/url-extractors/plume | 11 + scripts/url-extractors/reddit | 6 + scripts/url-extractors/tumblr | 31 ++ scripts/url-extractors/vimeo | 16 + scripts/url-extractors/youtube | 23 + templates/config | 15 + 40 files changed, 2229 insertions(+) create mode 100644 CHANGELOG create mode 100644 LICENSE create mode 100644 README.md create mode 100644 conf/tor-browser-header create mode 100644 docs/sites.md create mode 100644 docs/version create mode 100755 install create mode 100755 rsstube create mode 100644 rsstube.1 create mode 100644 scripts/determine_site create mode 100644 scripts/determine_software create mode 100644 scripts/http_errors create mode 100644 scripts/options create mode 100644 scripts/page-extractors/apple_podcasts create mode 100644 scripts/page-extractors/castro_fm create mode 100644 scripts/page-extractors/chirbit create mode 100644 scripts/page-extractors/fyyd create mode 100644 scripts/page-extractors/google_podcasts create mode 100644 scripts/page-extractors/invidious create mode 100644 scripts/page-extractors/mastodon create mode 100644 scripts/page-extractors/player_fm create mode 100644 scripts/page-extractors/pleroma create mode 100644 scripts/page-extractors/plume create mode 100644 scripts/page-extractors/pocketcasts create mode 100644 scripts/page-extractors/soundcloud create mode 100644 scripts/page-extractors/vimeo create mode 100644 scripts/page-extractors/writefreely create mode 100644 scripts/page-extractors/youtube create mode 100644 scripts/update create mode 100644 scripts/url-extractors/chirbit create mode 100644 scripts/url-extractors/deviantart create mode 100644 scripts/url-extractors/hugo create mode 100644 scripts/url-extractors/invidious create mode 100644 scripts/url-extractors/nitter create mode 100644 scripts/url-extractors/plume create mode 100644 scripts/url-extractors/reddit create mode 100644 scripts/url-extractors/tumblr create mode 100644 scripts/url-extractors/vimeo create mode 100644 scripts/url-extractors/youtube create mode 100644 templates/config diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..f3a1d23 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,126 @@ +# Changelog + +## [2020.01.10] - 2020-01-10 +- Switch from semantic versioning to calendar versioning +- Add support for more sites by software + +### Added +- Hugo +- Mastodon +- Pleroma +- Ability to identify Invidious and Nitter if they're not on the list of known domains + +### Changed +- Changed from semantic versioning to calendar versioning + +## [2.6.0] - 2020-01-08 +- Began support for feeds with unknown domains but known software + +### Added +- Added support for WriteFreely and Plume without knowing all domains ahead of time. +- Added more examples to documentation. + +### Fixed +- Fixed bugs in Tumblr and Vimeo extractors. + +## [2.5.2] - 2020-01-02 +- Fixed Cloudflare blocking Tor issue + +### Fixed +- Updated the "Tor mode" HTTP header info to bypass Cloudflare blocks. + +## [2.5.1] - 2019-12-31 +- Fixed YouTube video support issue + +### Fixed +- Updated support for rsstube on YouTube video pages following YouTube metadata format change. +- Fixed a bug with the updater. + +## [2.5.0] - 2019-12-28 +- Improved support for options + +### Added +- Added support for --long-options. + +### Fixed +- Improved config file robustness. + +## [2.4.0] - 2019-11-28 +- Realigned code with project goals + +### Added +- Added support for Nitter. + +### Removed +- Removed Invidious mode... Invidious and YouTube should be treated as separate things. + +## [2.3.0] - 2019-11-27 +- Added support for more curl options + +### Added +- Added (t)or flag to use appropriate HTTP headers to make Cloudflare think we're using the Tor Browser. +- Added (c)url flag to pass arbitrary arguments to curl. +- Added another podcast site (Player.fm). + +### Changed +- Did some code refactoring. + +## [2.2.1] - 2019-11-15 +- Fixed invidious option problem + +### Fixed +- Fixed problem with using -i "" as an option for YouTube/Invidious domain from URL not from config. + +## [2.2.0] - 2019-11-02 +- Added support for YouTube playlists and podcasts. + +### Added +- Feeds for YouTube/Invidious playlists. +- Get podcast feeds from Apple Podcasts, Castro.FM, Google Podcasts, and Pocket Casts. + +## [2.1.0] - 2019-11-02 +- Added support for Invidious. + +### Added +- Users can use Invidious URLs. +- Users can specify an Invidious instance to use instead of YouTube. + +### Fixed +- Fixed updater for git version. + +## [2.0.1] - 2019-10-31 +- Fixed updater. + +### Fixed +- Fixed updater. + +## [2.0.0] - 2019-10-23 +- Restructured program + +### Added +- Added support for more sites +- Added in-program updating +- Added more options + +## [1.1.0] - 2019-10-01 +- Improved efficiency. +- Added support for proxies. + +### Changed +- Greatly improve efficiency of processing video URLs. +- Switched to curl instead of wget. + +### Added +- Added support for proxies with curl. + +## [1.0.1] - 2019-08-31 +- Improved efficiency. + +### Changed +- Improve efficiency of processing channel URLs. + +## [1.0.0] - 2019-07-26 +- First numbered release. + +### Added +- Support for video URLs, not just channel URLs. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b0b1936 --- /dev/null +++ b/LICENSE @@ -0,0 +1,676 @@ + GPL-3.0-or-later + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3fbaaaa --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# rsstube + +**NOTE: This project has been archived. See https://negativezero.link/code/0x80/rsstube for the Python rewrite.** + +`rsstube` accepts a link (e.g., a YouTube channel) and attempts to get an RSS feed for that link. + +NOTE: If you downloaded `rsstube` v2.5.0 and installed it, please manually remove and re-install the program. I created a bug in that version that prevents the updater from working correctly. If you downloaded it with `git`, you can just `cd` into the directory and `git pull` to fix the issue. + +Sorry about that. + +## Dependencies + +Core utils like `curl` and `grep` are required. + +Note: This script was written and tested with Bash. I tried to make it portable, but it may not work with all shells. Please feel free to let me know if it doesn't work with your shell. + +## Installing + +### 1. Download the source. + +Clone the git repo. + +Extract the archive where you would like the files to be in (e.g., `/usr/local/share/applications/rsstube/` or `~/.rsstube/`). + +If the files are put into `~/.rsstube/` then `rsstube` will be able to update itself without root permission, but it will also be modifiable without root access, which may not be desired. + +### Using the Install Script + +#### 2. Run the `install` script as root: + +`sudo ./install` + +### Manually + +#### 2. Create a symlink for the `rsstube` file in `/usr/local/bin/`: + +`sudo ln -s [path]/rsstube /usr/local/bin/rsstube` + +#### 3. To add the manual for `rsstube` (optional, but recommended), symlink `rsstube.1` in `/usr/local/share/man/man1/`: + +`sudo ln -s [path]/rsstube /usr/local/share/man/man1/rsstube` + +#### 4. To update the manual database, run `mandb` as root: + +`sudo mandb` + +#### 5. If you want a config file, add it at `/etc/rsstube/config`: + +`sudo mkdir /etc/rsstube && sudo cp templates/config /etc/rsstube/config` + +## Updating + +To update `rsstube`, use `rsstube` with the -U option: + +`rsstube -U` + +Depending on where `rsstube` is installed, you may need to run this as root: + +`sudo rsstube -U` + +If you downloaded the git repository, this will just call `git pull`. + +There is no need to re-run the install script since the symlinks have already been created. + +## Usage + +`rsstube [OPTIONS] ` + +Note, URLs with ampersands (&) should be put in quotes so they aren't misinterpreted as commands by the shell. + +## Options + +`-c, --curl-args ` - Pass arbitrary arguments to curl. Not recommended unless you know what you're doing. + +`-h, --help` - Print help information. + +`-n, --non-network` - Non-network mode. Attempt to get RSS feed from URL only, and do not download page. + +`-p, --proxy ` - Specify a proxy argument for curl. The `-x` flag should not be specified. + +`-q, --quiet` - Make the `curl` call in silent mode. + +`-t, --tor-mode` - Set header information in the HTTP request so you appear to be using the Tor Browser. This is useful if you're using a Tor proxy (with `-p`) but Cloudflare blocks your request, demanding you complete a reCAPTCHA. Cloudflare is more suspicious of Tor traffic that is not from the Tor Browser, so if we pretend to be the Tor Browser, we can get around some of this. + +`-U, --update` - Update `rsstube`. + +`-V, --version` - Get `rsstube` version. + +A config file may also be specified in `/etc/rsstube/config` or in `~/.config/rsstube/config`. (In the case that both are present, only the local config file will be used.) This will provide default options. The options passed as arguments will take precedence over the config file. + +## Examples + +`rsstube https://www.youtube.com/channel/UCqC_GY2ZiENFz2pwL0cSfAw` + +`rsstube https://www.youtube.com/watch?v=XzIXc5CTC2M` + +`rsstube "https://www.youtube.com/watch?v=fFlfxwZDFzY&list=PL8D8D4240EC972114"` + +`rsstube -q https://soundcloud.com/greatnessgd` + +`rsstube -p socks5://localhost:9150 https://www.youtube.com/watch?v=XzIXc5CTC2M` + +`rsstube --proxy "socks5h://localhost:9050" -t https://player.fm/series/series-1456689` + +## How It Works + +`rsstube` gets the built-in RSS feed for various sites. It does not generate its own RSS feed and does not require a server. Generally, it works as such: + +### 1. `rsstube` looks at the URL and tries to determine a feed URL from it. + +Some sites' feed URLs can be easily derived from the generic URL, for instance by adding `/rss` to the end. + +### 2. If it was unable to derive the feed URL from the argument, it downloads the page (with `curl`) and tries to determine the feed URL based on information from the page. + +Some sites use, for instance, a user ID in their feed URLs, so `rsstube` needs to get that user ID from the page itself. + + +For more details about how feeds for a specific site work, see [docs/sites.md](docs/sites.md). diff --git a/conf/tor-browser-header b/conf/tor-browser-header new file mode 100644 index 0000000..fc28039 --- /dev/null +++ b/conf/tor-browser-header @@ -0,0 +1,10 @@ +-A "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0" +--tls-max 1.3 +--tls13-ciphers TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384 +--ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305-SHA256:ECDHE-RSA-CHACHA20-POLY1305-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384 +-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" +-H "Accept-Language: en-US,en;q=0.5" +-H "Accept-Encoding: gzip, deflate, br" +-H "Connection: keep-alive" +-H "Upgrade-Insecure-Requests: 1" +--compressed diff --git a/docs/sites.md b/docs/sites.md new file mode 100644 index 0000000..c9dee8d --- /dev/null +++ b/docs/sites.md @@ -0,0 +1,193 @@ +# Sites + +Below are two lists: Sites that are supported by rsstube, and sites that are explicitly not supported (because they do not seem to natively support RSS). If any of the unsupported sites actually do support RSS natively, or if you want me to add/look into a site that's not on either list, please let me know. + +I tried to give sample URLs for each site or software. These are just examples and should not be taken as endorsements. I like some of them, but for some of them, I just needed examples. + +- [Supported Sites](#supported-sites) +- [Unsupported Sites](#unsupported-sites) + +## Supported Sites + +These sites support RSS natively, and rsstube can get a feed for them. + +- [Chirbit](#chirbit) +- [DeviantArt](#deviantart) +- [Hugo](#hugo) +- [Invidious](#invidious) +- [Mastodon](#mastodon) +- [Nitter](#nitter) +- [Pleroma](#pleroma) +- [Plume](#plume) +- [Podcasts](#podcasts) +- [Reddit](#reddit) +- [Soundcloud](#soundcloud) +- [Tumblr](#tumblr) +- [Vimeo](#vimeo) +- [WriteFreely](#writefreely) +- [YouTube](#youtube) + +### Chirbit +Chirbit users have a built-in RSS feed at `https://www.chirbit.com/[username]/rss`. If a user's page URL is passed in, `rsstube` just appends `/rss` after the username. If a track URL (at `chirb.it`) is passed in, the page is downloaded, and the username is grabbed from the page. + +Sample URLs: + +- https://www.chirbit.com/Giannaa -> https://www.chirbit.com/Giannaa/rss +- https://chirb.it/9qxaAG -> https://www.chirbit.com/Giannaa/rss + +### DeviantArt +DeviantArt RSS URLs are complicated, but the basic idea is `https://backend.deviantart.com/rss.xml` followed by arguments. A feed for a given user's deviations can be found at: +`https://backend.deviantart.com/rss.xml?type=deviation&q=by%3A[username]+sort%3Atime+meta%3Aall`. See [the DeviantArt page on RSS feeds](https://www.deviantart.com/developers/rss) for more information. + +`rsstube` doesn't do anything fancy here; it just generates the above URL for the given user. + +Sample URLs: + +- https://www.deviantart.com/sashakhmel -> https://backend.deviantart.com/rss.xml?type=deviation&q=by%3Asashakhmel+sort%3Atime+meta%3Aall +- https://www.deviantart.com/sashakhmel/art/lady-in-armor-825805802 -> https://backend.deviantart.com/rss.xml?type=deviation&q=by%3Asashakhmel+sort%3Atime+meta%3Aall + +### Hugo +Sites generated with [Hugo](https://gohugo.io/) have a feed at `/index.xml`. I don't know if this is true of all Hugo sites, but it at least sometimes works. + +Sample URLs: + +- https://gohugo.io/ -> https://gohugo.io/index.xml +- https://lesbianhacker.neocities.org/ -> https://lesbianhacker.neocities.org/index.xml + +### Invidious +Invidious is basically a free software proxy to YouTube with [several public instances](https://github.com/omarroth/invidious/wiki/Invidious-Instances), and it supports URL schemes in the same way [YouTube](#youtube) does. It also supports other things, for instance, URLs in the form `https://www.youtube.com/user/[username]` have an Invidious RSS feed at `[invidious domain]/feed/channel/[username]`. Playlist feeds can be found at `[invidious domain]/feed/playlist/[playlist_id]`. + +If the page must be downloaded to find additional information, `rsstube` looks for `
`, and uses that to form `[domain]/feed/channel/[channel_id]`. + +Sample URLs: + +- https://invidio.us/watch?v=UEQfaTntFNw -> https://invidio.us/feeds/videos.xml?channel_id=UCo3AxjxePfj6DHn03aiIhww +- http://axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion/watch?v=4jYsu5-TJQ8 -> http://axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion/feeds/videos.xml?channel_id=UCFn5CIjfAj-KZgJtsXw349g +- https://invidio.us/channel/UCqC_GY2ZiENFz2pwL0cSfAw -> https://invidio.us/feed/channel/UCqC_GY2ZiENFz2pwL0cSfAw + +### Mastodon +Mastodon user pages are at `[domain]/@[username]`, and posts are at `[domain]/@[username]/[postID]`. Mastodon user pages can also be found at `[domain]/users/[username]` (I think for compatability with Pleroma). The RSS feed for a given user is at `[domain]/@[username].rss`. + +Sample URLs: + +- https://mastodon.social/@gargron -> https://mastodon.social/@gargron.rss + +### Nitter +Nitter is like Invidious, but for Twitter. It has [several public instances](https://github.com/zedeus/nitter/wiki/Instances). Nitter feeds have URLs at `[nitter domain]/[username]/rss`. + +Note, Twitter is not supported. + +Sample URLs: + +- https://nitter.net/doctorow -> https://nitter.net/doctorow/rss +- http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion/doctorow/status/1214288190317592576#m -> http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion/doctorow/rss + +### Pleroma +Pleroma user URLs are at `[domain]/users/[username]`. The Atom feed for a given user is at `[domain]/users/[username]/feed.atom`. This may not work for all instances. + +Sample URLs: + +- https://kawen.space/users/314 -> https://kawen.space/users/314/feed.atom + +### Plume +Some Plume pages directly link to the Atom feed in an alternate link. `rsstube` first looks for this link: ``. If it doesn't find the link, it tries to create it. The feed for a given user is at `[domain]/@/[username]/atom.xml`. If the provided URL is a user's page (`[domain]/@/[username]`), it just puts the `atom.xml` on the end. If it's a blog post (`[domain]/~/[username]/[post-title]/`), it looks for a link to the user page: `` and appends the `atom.xml` to that. + +Sample URLs: + +- https://blog.funkwhale.audio/@/funkwhale -> https://blog.funkwhale.audio/@/funkwhale/atom.xml +- https://fediverse.blog/~/MusingsByRg/firefox-add-ons-for-the-active-user -> https://fediverse.blog/@/rgx/atom.xml + +### Podcasts +A podcast is just an RSS feed, but a lot of people post links to specific services like Apple Podcasts, instead of just posting the feed link. `rsstube` supports the following podcast sites, so you should be able to put in the URL for a podcast, and it will return the RSS feed URL. + +Basically, `rsstube` just looks on the page for a link to the actual RSS file. + +Sites with sample URLs: + +- Apple Podcasts (https://podcasts.apple.com/us/podcast/irl-online-life-is-real-life/id1247652431 -> https://feeds.mozilla-podcasts.org/irl) +- Castro.fm (https://castro.fm/podcast/b3891201-4d76-4152-adeb-ae3e13d17f29 -> https://www.smashingsecurity.com/rss) +- fyyd (https://fyyd.de/podcast/shades-of-brown/0 -> https://twoshadesofbrown.com/feed/podcast/) +- Google Podcasts (https://podcasts.google.com/?feed=aHR0cHM6Ly9wb2RjYXN0Lm5lYXJseW9ucmVkLmNvbS9mZWVkLnhtbA -> https://podcast.nearlyonred.com/feed.xml) +- Player.fm (https://player.fm/series/tea-with-queen-and-j -> http://feeds.soundcloud.com/users/soundcloud:users:83464467/sounds.rss) +- Pocket Casts (https://pca.st/iHi8 -> https://feeds.simplecast.com/ZL7iUDiH) + +### Reddit +Reddit URLs are extremely hackable, so `rsstube` assumes the user wants a feed for the actual URL provided, not specifically a user or a subreddit. To get an RSS feed for a Reddit page, just add `/.rss` to the end of the URL. + +Sample URLs: + +- https://old.reddit.com/r/privacy/ -> https://old.reddit.com/r/privacy/.rss +- https://www.reddit.com/r/onions+tor+onionlovers/ -> https://www.reddit.com/r/onions+tor+onionlovers/.rss + +### Soundcloud +Soundcloud users have built-in RSS feeds, which `rsstube` returns; **however, by default tracks are not added to them.** The feed comes in the form: `https://feeds.soundcloud.com/users/soundcloud:users:[user_id]/sounds.rss` + +To get the user ID, we download the page and search for the string `soundcloud:users:[user_id]"` + +Unfortunately, most Soundcloud RSS feeds will be empty, unless they are for a serialized podcast or something like that. + +Sample URLs: + +- https://soundcloud.com/greatnessgd -> https://feeds.soundcloud.com/users/soundcloud:users:2097827/sounds.rss +- https://soundcloud.com/user-98066669 -> https://feeds.soundcloud.com/users/soundcloud:users:261098918/sounds.rss + +### Tumblr +Tumblr provides an RSS feed for a given page at `[page URL]/rss`. For example, the feed for `username`'s posts will be: `https://username.tumblr.com/rss`. If you wanted all of `username`'s posts that were tagged `funny`, you could use `https://username.tumblr.com/tagged/funny/rss` + +(Note: Tumblr does not support HTTPS on all pages, so the URL may actually start with `http://` ) + +Sample URLs: + +- https://william-snekspeare.tumblr.com/ -> https://william-snekspeare.tumblr.com/rss +- https://william-snekspeare.tumblr.com/tagged/comic -> https://william-snekspeare.tumblr.com/tagged/comic/rss + +### Vimeo +The Vimeo RSS feed for a user comes in the form: `https://vimeo.com/user[user_id]/videos/rss` + +If `rsstube` receives a URL in the form `https://vimeo.com/user[user_id]/` it can just append `videos/rss` to the end. If it receives a video URL, it will need to download the video page and find the user ID. It can be found in various parts of the page, including by searching for `creator_id` + +Sample URLs: + +- https://vimeo.com/user51602410 -> https://vimeo.com/user51602410/videos/rss +- https://vimeo.com/63502573 -> https://vimeo.com/user2617788/videos/rss + +### Write.as +See [WriteFreely](#writefreely). + +### WriteFreely +WriteFreely(/Write.as) puts an RSS feed at `[user page]/feed/`. For single-user instances, this means `[domain]/feed/`, and for multi-user instances, this means `[domain]/[username]/feed/`. + +The user's page also lists the feed directly in a link element: `` + +Sample URLs: + +- https://tomskee.dev/ -> https://tomskee.dev/feed/ +- https://tomskee.dev/claiming-2020-for-myself -> https://tomskee.dev/feed/ +- https://wordsmith.social/rgx/ -> https://wordsmith.social/rgx/feed/ +- https://wordsmith.social/rgx/is-it-important-which-instance-you-are-in -> https://wordsmith.social/rgx/feed/ + +### YouTube +The YouTube RSS feed comes in the form: `https://www.youtube.com/feeds/videos.xml?channel_id=[channel_id]` + +Some YouTube channels have a URL in the form: `https://www.youtube.com/channel/[channel_id]`. In this case, we just take the channel ID from the end of the URL. In the case of `https://www.youtube.com/user/[username]` we can instead use `https://www.youtube.com/feeds/videos.xml?user=[username]`. For a playlist (`https://www.youtube.com/playlist?list=[playlist_id]`) we can use `https://www.youtube.com/feeds/videos.xml?playlist_id=[playlist_id]`. + +If the channel's URL is not in this form (e.g., if the user passes in a video URL), we download the page and try to get the channel ID from the metadata. YouTube seems to have moved this metadata info to JSON that's parsed by the JavaScript. `rsstube` now looks for the string: (`"channelId":"[channel_id]"`). If it's a user/channel page that for some reason wasn't already covered, we can also just use the canonical link to the /channel/ page (``). + +Sample URLs: + +- https://www.youtube.com/channel/UCqC_GY2ZiENFz2pwL0cSfAw -> https://www.youtube.com/feeds/videos.xml?channel_id=UCqC_GY2ZiENFz2pwL0cSfAw +- https://www.youtube.com/watch?v=XzIXc5CTC2M -> https://www.youtube.com/feeds/videos.xml?channel_id=UCexJsljKV3x4x8p0eyTrjVg +- https://www.youtube.com/watch?v=fFlfxwZDFzY&list=PL8D8D4240EC972114 (playlist - put this in quotes) -> https://www.youtube.com/feeds/videos.xml?playlist_id=PL8D8D4240EC972114 + +## Unsupported Sites + +These sites are explicitly unsupported because they do not seem to support RSS natively. For these sites, you might have better luck with a tool like [RSS Box](https://github.com/stefansundin/rssbox) that can be run from your own server (or may have public instances) to create the RSS feed. + +Links here are not guaranteed to be accurate but are included for some reference of why I believe the given site does not support RSS natively. + +- Bandcamp [x](https://old.reddit.com/r/BandCamp/comments/6c47bh/question_no_more_rss_feeds/) [x](https://old.reddit.com/r/BandCamp/comments/9h2kcu/rss_reader_for_bandcamp_feed/) +- Meetup [requires API requests to be authenticated](https://www.meetup.com/meetup_api/auth/). +- Instagram [x](https://stackoverflow.com/questions/14747870/instagram-public-rss-feed) +- TikTok +- Twitch [x](https://discuss.dev.twitch.tv/t/twitch-rss-feed-link/1105) +- Twitter [x](https://twittercommunity.com/t/does-api-1-1-no-longer-support-rss-feeds/11257) diff --git a/docs/version b/docs/version new file mode 100644 index 0000000..01692f5 --- /dev/null +++ b/docs/version @@ -0,0 +1 @@ +2020.01.10 diff --git a/install b/install new file mode 100755 index 0000000..4faa6f1 --- /dev/null +++ b/install @@ -0,0 +1,70 @@ +#!/bin/sh + +ERR='\033[0;31m' +WARN='\033[0;33m' +NC='\033[0m' + +path=`dirname "$(readlink -f "$0")"` + +if [ $EUID -ne 0 ]; then + echo -e "${ERR}In order to install this utility, root permissions must be granted.${NC}" + echo "This script will add files to the following directories:" + echo "/usr/local/bin/" + echo "/usr/local/share/man/man1/" + echo "/etc/" + echo "" + echo 'Please run as root by switching to superuser first or running as "sudo install"' + echo "Alternatively, you can manually install this utility by symlinking $path/rsstube in /usr/local/bin/ and $path/rsstube.1 in /usr/local/share/man/man1/" + echo "Afterwards, run mandb as root to update your manual database." + echo "Copy the templates/config file to /etc/rsstube/" + exit +fi + +execpath=/usr/local/bin/rsstube +manpath=/usr/local/share/man/man1/rsstube.1 +file_problem="" + +if [[ -e $execpath ]] +then +# rm $execpath + echo -e "${WARN}Error: $execpath already exists.${NC}" + echo "If it was added from a version of rsstube < 2.0.0, then please delete it before installing:" + echo "sudo rm $execpath" + file_problem="true" +fi + +if [[ -e $manpath ]] +then +# rm $manpath + echo -e "${WARN}Error: $manpath already exists.${NC}" + echo "If it was added from a version of rsstube < 2.0.0, then please delete it before installing:" + echo "sudo rm $manpath" + file_problem="true" +fi + +if [[ -e /usr/bin/rsstube ]] +then + echo -e "${WARN}Error: /usr/bin/rsstube exists and has a conflicting name.${NC}" + echo "Please delete /usr/bin/rsstube:" + echo "sudo rm /usr/bin/rsstube" + file_problem="true" +fi + +if [[ -n $file_problem ]] +then + echo -e "${WARN}Failed to install. Please fix above problems before trying again.${NC}" + exit +fi + + +ln -s $path/rsstube /usr/local/bin/rsstube +ln -s $path/rsstube.1 /usr/local/share/man/man1/rsstube.1 +mandb +if [[ ! -d /etc/rsstube ]] +then + mkdir /etc/rsstube +fi +cp templates/config /etc/rsstube/config + +echo "rsstube is now installed. You can use it by typing:" +echo "rsstube " diff --git a/rsstube b/rsstube new file mode 100755 index 0000000..6eaf7c8 --- /dev/null +++ b/rsstube @@ -0,0 +1,187 @@ +#!/bin/sh + +# rsstube - get RSS feed for YouTube channels and other sites +# Copyright (C) 2019 +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# run from absolute path of rsstube executable +cd `dirname "$(readlink -f "$0")"` + + +### UTILITIES +ERR='\033[1;31m' +WARN='\033[1;33m' +NC='\033[0m' + +## for general output +notify() { + if [[ ! -n "$quiet" ]] + then + output "${1}" + fi +} + +## for warning-level information, output in yellow +warn() { + if [[ ! -n "$quiet" ]] + then + echo -e "${WARN}${1}${NC}" + fi +} + +## for errors. cannot be silenced, output in red +error() { + echo -e "${ERR}${1}${NC}" +} + +## fail to get feed, terminate program +fail() { + error "Unable to get RSS feed." + exit +} + +## general output, no formatting +output() { + echo "${1}" +} + +## determine whether HTTP or HTTPS +## some sites may not support HTTPS +determine_protocol() { + protocol=${url%//*} + if [[ $protocol == $url ]] + then + protocol="http://" + else + protocol="${protocol}//" + fi +} + +## get domain of URL +get_domain() { + domain=${url#*//} + domain=${domain%%/*} +} + +## attempt to get feed from URL only +## if successful, output feed and terminate +url_extract() { + if [[ -f scripts/url-extractors/${site} ]] + then + source scripts/url-extractors/${site} + fi + + if [[ -n $url_ext ]] + then + output $url_ext + exit + fi +} + +## attempt to get feed from page data +## if successful, output feed and terminate +page_extract() { + if [[ -f scripts/page-extractors/${site} ]] + then + source scripts/page-extractors/$site + fi + + if [[ -n $page_ext ]] + then + output $page_ext + exit + fi +} + + +# get user arguments +source scripts/options + +# determine site ("" if not supported) +source scripts/determine_site + +# get protocol and domain +determine_protocol +get_domain + +if [[ -n "$site" ]] +then + notify "Site identified as $site" +fi + +url_extract + +if [[ -n $site ]] +then + notify "Unable to get feed from URL alone." +fi + + +# if no page extractor exists or user has opted not to download page, don't download the page +if [[ $network == "false" ]] || [[ -n $site && ! -f scripts/page-extractors/${site} ]] +then + fail +fi + + +# determine flags to pass to curl +args=" ${curl_args}" + +vars=("proxy" "quiet") +for i in "${vars[@]}" +do + if [[ -n "${!i}" ]] + then + args="$args ${!i}" + fi +done + +command="curl -L -i -D -$args $url" + +notify "Downloading page..." +# download page with curl +content=`eval $command` + + +# check download for errors +source scripts/http_errors + + +# if unknown domain, try to determine if it uses known software +if [[ "$site" == "" ]] +then + notify "Attempting to determine if site uses known software..." + source scripts/determine_software + if [[ -n "$site" ]] + then + notify "Software identified as $site" + software_found="true" + fi +fi + +# try to extract feed from page +notify "Attempting to get feed from page..." +page_extract +notify "Unable to get feed from page." + +# try to get feed from URL if we determined the software +if [[ -n $software_found ]] +then + url_extract + notify "Unable to get feed from URL based on software." +fi + +# unable to get feed +fail diff --git a/rsstube.1 b/rsstube.1 new file mode 100644 index 0000000..fd33375 --- /dev/null +++ b/rsstube.1 @@ -0,0 +1,85 @@ +.\" Manual for rsstube. +.TH man rsstube 1 "10 January 2020" "" "rsstube manual" +.SH NAME +rsstube \- get feed for a page +.SH SYNOPSIS +\f[B]rsstube\f[] [OPTIONS] URL +.SH DESCRIPTION +rsstube attempts to get an RSS feed for a page from a supported site. If it can determine the feed URL based on the page URL, it does so. Otherwise, it uses \f[B]curl\f[] to download the page and tries to use information from the page to find the feed URL. +.SH OPTIONS +.TP +.BR \-c,\ --curl-args +\fIARGS\fR +pass arbitrary arguments to curl, not recommended unless you know what you're doing +.TP +.BR \-h,\ --help +print help information +.TP +.BR \-n,\ --non-network +non-network mode (only try to get feed without downloading page) +.TP +.BR -p,\ --proxy +\fIPROXY\fR +specify a proxy argument for curl +.TP +.BR \-q,\ --quiet +only output error messages (suppress warnings and notifications) +.TP +.BR \-t,\ --tor-mode +pretend to be Tor Browser (to evade Cloudflare scrutiny while using a Tor proxy with -p) +.TP +.BR \-U,\ --update +update rsstube +.TP +.BR \-V,\ --version +Get rsstube version +.SH EXAMPLES +.TP +rsstube https://www.youtube.com/channel/UCqC_GY2ZiENFz2pwL0cSfAw +.TP +rsstube https://www.youtube.com/watch?v=XzIXc5CTC2M +.TP +rsstube "https://www.youtube.com/watch?v=fFlfxwZDFzY&list=PL8D8D4240EC972114" +.TP +rsstube -q https://soundcloud.com/greatnessgd +.TP +rsstube -p "socks5h://localhost:9150" https://www.youtube.com/watch?v=XzIXc5CTC2M +.TP +rsstube --proxy "socks5h://localhost:9050" -t https://player.fm/series/series-1456689 +.SH CONFIG OPTIONS +A config file can be specified at /etc/rsstube/config or ~/.config/rsstube/config. This file may contain the same options listed above. Arguments to rsstube supercede the config file options. +.SH CURRENTLY SUPPORTED SITES +.TP +Assorted podcast sites +.TP +Chirbit +.TP +DeviantArt +.TP +Hugo +.TP +Invidious +.TP +Mastodon +.TP +Nitter +.TP +Pleroma +.TP +Plume +.TP +Reddit +.TP +Soundcloud +.TP +Tumblr +.TP +Vimeo +.TP +WriteFreely +.TP +YouTube +.SH LICENSE +GPLv3+ +.SH CURRENT VERSION +2020.01.10 diff --git a/scripts/determine_site b/scripts/determine_site new file mode 100644 index 0000000..182b50d --- /dev/null +++ b/scripts/determine_site @@ -0,0 +1,113 @@ +supported_sites=( + "apple_podcasts" + "castro_fm" + "chirbit" + "deviantart" + "google_podcasts" + "fyyd" + "invidious" + "nitter" + "player_fm" + "pocketcasts" + "reddit" + "soundcloud" + "tumblr" + "vimeo" + "youtube" +) + +apple_podcasts=( + "podcasts.apple.com" + "itunes.apple.com/*/podcast" +) + +castro_fm=("castro.fm") + +chirbit=( + "chirbit.com" + "chirb.it" +) + +deviantart=("deviantart.com") + +fyyd=("fyyd.de/podcast/") + +google_podcasts=("podcasts.google.com") + +invidious=( + "invidio.us" + "kgg2m7yk5aybusll.onion" + "axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion" + "invidious.snopyta.org" + "vid.wxzm.sx" + "invidiou.sh" + "tube.poal.co" + "yt.elukerio.org" + "invidious.drycat.fr" + "yt.lelux.fi" + "watch.nettohikari.com" + "fz253lmuao3strwbfbmx46yu7acac2jz27iwtorgmbqlkurlclmancad.onion" + "qklhadlycap4cnod.onion" + "c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion" + "invidious.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion" +) + +nitter=( + "nitter.net" + "nitter.snopyta.org" + "nitter.42l.fr" + "nitter.nixnet.xyz" + "nitter.lelux.fi" + "nitter.pro" + "nitter.13ad.de" + "nitter.drycat.fr" + "3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion" + "nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion" + "nitteruacegiyzybcc2xej3obcti3dlysz5l5jns7ob4gict6tcualid.onion" +) + +player_fm=("player.fm/series/") + +pocketcasts=("pca.st") + +reddit=("reddit.com") + +soundcloud=("soundcloud.com") + +tumblr=("tumblr.com") + +vimeo=("vimeo.com") + +youtube=( + "youtube.com" + "youtu.be" + "yt.be" + "youtube-nocookie.com" + "youtubeeducation.com" + "youtubegaming.com" + "ytimg.com" +) + +shopt -s nocasematch + +match_found="false" + +for possible_site in ${supported_sites[@]} +do + declare -n possible_domains="$possible_site" + for domain in ${possible_domains[@]} + do + if [[ "$url" == *$domain* ]] + then + site="$possible_site" + match_found="true" + break + fi + done + if [[ $match_found == "true" ]] + then + break + fi +done + +shopt -u nocasematch diff --git a/scripts/determine_software b/scripts/determine_software new file mode 100644 index 0000000..3d634a7 --- /dev/null +++ b/scripts/determine_software @@ -0,0 +1,63 @@ +supported_sites=( + "hugo" + "invidious" + "mastodon" + "nitter" +# "peertube" + "pleroma" + "plume" + "writefreely" +) + +hugo=( + '' +) + +invidious=( + '' +) + +mastodon=( + "
\n

Developers

\n\n
" +) + +nitter=( + '' +) + +# note: we can identify PeerTube, but I don't know how to get the feed yet +#peertube=( +# '' +#) + +pleroma=( + '' + 'Pleroma' +) + +plume=( + '
\n

Plume [0-9]{1,}.[0-9]{1,}.[0-9]{1,}

\n Documentation\n Source code\n Matrix room\n
' +) + +writefreely=( + '' + '' +) + +for possible_site in ${supported_sites[@]} +do + declare -n possible_patterns="$possible_site" + for pattern in "${possible_patterns[@]}" + do + site_pattern_match=`echo "$content" | grep -Pzo "$pattern" | tr '\0' '\n'` + if [[ -n "$site_pattern_match" ]] + then + site="$possible_site" + break + fi + done + if [[ -n "$site" ]] + then + break + fi +done diff --git a/scripts/http_errors b/scripts/http_errors new file mode 100644 index 0000000..5a8d239 --- /dev/null +++ b/scripts/http_errors @@ -0,0 +1,89 @@ +cloudflare="" +recaptcha="" + +# Cloudflare test +cloudflare=`echo "$content" | grep "Attention Required! | Cloudflare"` +if [[ -n "${cloudflare}" ]] +then + error "Cloudflare blocked the request." + + if [[ -n "${proxy}" ]] + then + warn "Are you using Tor? If so, try using rsstube again with the -t option." + fi +fi + +# general Google reCAPTCHA +recaptcha=`echo "$content" | grep "google.com/recaptcha/api"` +if [[ -n "${recaptcha}" ]] +then + error "reCAPTCHA requested" +fi + +# HTTP errors +http_response=`echo "$content" | head -1 | xargs` +http_response=${http_response#* } + +# print appropriate status code +case $http_response in + # 2xx success + 200) response_message="200 OK" ;; + + # 3xx redirection should already be handled by curl -L flag + 301) response_message="301 Moved Permanently" ;; + 302) response_message="302 Found" ;; + 303) response_message="303 See Other" ;; + 307) response_message="307 Temporary Redirect" ;; + 308) response_message="308 Permanent Redirect" ;; + + # 4xx client errors + 400) response_message="400 Bad Request" ;; + 401) response_message="401 Unauthorized" ;; + 402) response_message="402 Payment Required" ;; + 403) response_message="403 Forbidden" ;; + 404) response_message="404 Not Found" ;; + 405) response_message="405 Method Not Allowed" ;; + 406) response_message="406 Not Acceptable" ;; + 407) response_message="407 Proxy Authentication Required" ;; + 408) response_message="408 Request Timeout" ;; + 409) response_message="409 Conflict" ;; + 410) response_message="410 Gone" ;; + 411) response_message="411 Length Required" ;; + 412) response_message="412 Precondition Failed" ;; + 413) response_message="413 Payload Too Large" ;; + 414) response_message="414 URI Too Long" ;; + 415) response_message="415 Unsupported Media Type" ;; + 416) response_message="416 Range Not Satisfiable" ;; + 417) response_message="417 Expectation Failed" ;; + 418) response_message="418 I'm a teapot" ;; + 421) response_message="421 Misdirected Request" ;; + 422) response_message="422 Unprocessable Entity" ;; + 423) response_message="423 Locked" ;; + 424) response_message="424 Failed Dependency" ;; + 425) response_message="425 Too Early" ;; + 426) response_message="426 Upgrade Required" ;; + 428) response_message="428 Precondition Required" ;; + 429) response_message="429 Too Many Requests" ;; + 431) response_message="431 Request Header Fields Too Large" ;; + 451) response_message="451 Unavailable For Legal Reasons" ;; + + # 5xx server errors + 500) response_message="500 Internal Server Error" ;; + 501) response_message="501 Not Implemented" ;; + 502) response_message="502 Bad Gateway" ;; + 503) response_message="503 Service Unavailable" ;; + 504) response_message="504 Gateway Timeout" ;; + 505) response_message="505 HTTP Version Not Supported" ;; + 506) response_message="506 Variant Also Negotiates" ;; + 507) response_message="507 Insufficient Storage" ;; + 508) response_message="508 Loop Detected" ;; + 510) response_message="510 Not Extended" ;; + 511) response_message="511 Network Authentication Required" ;; +esac + +response_message="Server responded ${response_message}" +case ${response_message:17:1} in + 2) notify "$response_message" ;; + 3) warn "$response_message" ;; + 4|5) error "$response_message" ;; +esac diff --git a/scripts/options b/scripts/options new file mode 100644 index 0000000..a6aeb6d --- /dev/null +++ b/scripts/options @@ -0,0 +1,129 @@ +# specify arbitrary curl arguments - passed directly to curl +c() { + curl_args="$1" +} + +# help +h() { + echo "Usage: rsstube [OPTIONS] URL" + echo "Do 'man rsstube' to see the manual for rsstube." + exit +} + +# non-network mode (do not download page) +n() { + network="false" +} + +# proxy +p() { + proxy="-x $1 " +} + +# quiet (use curl in silent mode) +q() { + quiet="--silent " +} + +# curl options for Tor (to avoid Cloudflare blocks) +t() { + tor_header="" + while read line + do + tor_header="${tor_header}${line} " + done < conf/tor-browser-header + curl_args="${curl_args} ${tor_header}" +} + +# update rsstube +U() { + update="true" +} + +# display version +V() { + version=`cat docs/version` + echo "rsstube v${version}" + exit +} + +global_config="/etc/rsstube/config" +local_config="$HOME/.config/rsstube/config" +config_file="" + +# local_config takes precedence over global_config, and only one (at most) will be used +if [[ -f "$local_config" ]] +then + config_file=${local_config} +elif [[ -f "$global_config" ]] +then + config_file=${global_config} +fi + +# default assume we're not using Tor mode +tor_mode="" + +if [[ -n "$config_file" ]] +then + while read line + do + # cut whitespace from beginning of line + line=${line##*( )} + + # ignore commented out lines + if [[ -n $line && ${line:0:1} != "#" ]] + then + # get just argument + cmd=${line%% *} + + case $cmd in + -c|--curl-args) c "${line#* }" ;; + -h|--help|help) h ;; + -n|--non-network) n ;; + -p|--proxy) p "${line#* }" ;; + -q|--quiet) q ;; + -t|--tor-mode) tor_mode="true" ;; + -U|--update) U ;; + -V|--version) V ;; + *) error "Unsupported option."; exit ;; + esac + fi + done < "$config_file" +fi + +# options from method call take precedence over config file options +while [[ $# -gt 0 ]] +do + cmd="${1}" + case $cmd in + -c|--curl-args) shift; c "${1}" ;; + -h|--help|help) h ;; + -n|--non-network) n ;; + -p|--proxy) shift; p "${1}" ;; + -q|--quiet) q ;; + -t|--tor-mode) tor_mode="true" ;; + -U|--update) U ;; + -V|--version) V ;; + *) url="${1}" ;; + esac + + # finish with this command + shift +done + +if [[ "${update}" == "true" ]] +then + source scripts/update + exit +fi + +if [[ -n "${tor_mode}" ]] +then + t +fi + +if [[ ! -n "${url}" ]] +then + error "No URL supplied!" + exit +fi diff --git a/scripts/page-extractors/apple_podcasts b/scripts/page-extractors/apple_podcasts new file mode 100644 index 0000000..19fc05a --- /dev/null +++ b/scripts/page-extractors/apple_podcasts @@ -0,0 +1,6 @@ +rss=`echo "$content" | grep -o -P '(?<="feedUrl":").*?(?=")' | head -1` + +if [[ -n "$rss" ]] +then + page_ext=$rss +fi diff --git a/scripts/page-extractors/castro_fm b/scripts/page-extractors/castro_fm new file mode 100644 index 0000000..1fc550a --- /dev/null +++ b/scripts/page-extractors/castro_fm @@ -0,0 +1 @@ +page_ext=`echo "$content" | grep -Pzo '(?<=Subscribe to RSS).*?(?=)' | head -1` + +if [[ -n "$username" ]] +then + rss="https://www.chirbit.com/$username/rss" + page_ext=$rss +fi diff --git a/scripts/page-extractors/fyyd b/scripts/page-extractors/fyyd new file mode 100644 index 0000000..2a212d5 --- /dev/null +++ b/scripts/page-extractors/fyyd @@ -0,0 +1 @@ +page_ext=`echo "$content" | grep -Po '(?<=)' | head -1 | tr '\0' '\n'` diff --git a/scripts/page-extractors/google_podcasts b/scripts/page-extractors/google_podcasts new file mode 100644 index 0000000..29d874b --- /dev/null +++ b/scripts/page-extractors/google_podcasts @@ -0,0 +1 @@ +page_ext=`echo "$content" | grep -Po '(?<=data-feed=").*?(?=">)' | head -1 | tr '\0' '\n'` diff --git a/scripts/page-extractors/invidious b/scripts/page-extractors/invidious new file mode 100644 index 0000000..3a6ae95 --- /dev/null +++ b/scripts/page-extractors/invidious @@ -0,0 +1,11 @@ +determine_protocol +get_domain +instance="${protocol}${domain}" + +channel=`echo $content | grep -Pzo '(?<=
)'` diff --git a/scripts/page-extractors/pleroma b/scripts/page-extractors/pleroma new file mode 100644 index 0000000..e7f665a --- /dev/null +++ b/scripts/page-extractors/pleroma @@ -0,0 +1,25 @@ +determine_protocol +get_domain + +# check for explicit feed link +feed_link=`echo "$content" | grep -Po '(?<=)' | head -1 | tr '\0' '\n'` +if [[ -n $feed_link ]] +then + page_ext="${protocol}${domain}${feed_link}" +fi + +# if explicit feed link not found get user URL and add /feed.atom +if [[ "$page_ext" == "" ]] +then + determine_protocol + get_domain + username="${url##*//}" + username="${username#*/}" + + if [[ "$username" == users/* ]] + then + username="${username#*/}" + username="users/${username%%/*}" + page_ext="${protocol}${domain}/${username}/feed.atom" + fi +fi diff --git a/scripts/page-extractors/plume b/scripts/page-extractors/plume new file mode 100644 index 0000000..91c1219 --- /dev/null +++ b/scripts/page-extractors/plume @@ -0,0 +1,19 @@ +page_ext=`echo "$content" | grep -Po "(?<=)" | head -1` + +determine_protocol +get_domain + +if [[ ! -n $page_ext ]] +then + # blog page + if [[ "$url" == *${domain}/~/* ]] + then + # get link to user page + user_link=`echo $content | grep -Po '(?<=)' | head -1` + if [[ -n $user_link ]] + then + # get Atom feed + page_ext="${user_link%%/}/atom.xml" + fi + fi +fi diff --git a/scripts/page-extractors/pocketcasts b/scripts/page-extractors/pocketcasts new file mode 100644 index 0000000..b45fd1b --- /dev/null +++ b/scripts/page-extractors/pocketcasts @@ -0,0 +1 @@ +page_ext=`echo "$content" | grep -Po '(?<=)' | head -1 | tr '\u' '\n'` diff --git a/scripts/page-extractors/soundcloud b/scripts/page-extractors/soundcloud new file mode 100644 index 0000000..481bfb1 --- /dev/null +++ b/scripts/page-extractors/soundcloud @@ -0,0 +1,7 @@ +users=`echo $content | grep -o -P '(?<=soundcloud:users:).*?(?=")' | head -1` + +if [[ -n "$users" ]] +then + rss="https://feeds.soundcloud.com/users/soundcloud:users:"${users}"/sounds.rss" + page_ext=$rss +fi diff --git a/scripts/page-extractors/vimeo b/scripts/page-extractors/vimeo new file mode 100644 index 0000000..b91f737 --- /dev/null +++ b/scripts/page-extractors/vimeo @@ -0,0 +1,20 @@ +username=`echo "$content" | grep -o -P '(?<="creator_id":).*?(?=,)' | head -1` + +# try multiple labels, in case some only work sometimes + +if [[ ! -n "$username" ]] +then + username=`echo $content | grep -o -P '(?<="owner":{"id":).*?(?=,"display_name":")' | head -1` +fi + +if [[ ! -n "$username" ]] +then + username=`echo $content | grep -o -P '(?<="item":{"@id":"https://vimeo.com/user).*?(?=","name":)' | head -1` +fi + +# return URL only if username was found +if [[ -n "$username" ]] +then + rss="https://vimeo.com/user$username/videos/rss" + page_ext=$rss +fi diff --git a/scripts/page-extractors/writefreely b/scripts/page-extractors/writefreely new file mode 100644 index 0000000..f859ee0 --- /dev/null +++ b/scripts/page-extractors/writefreely @@ -0,0 +1,21 @@ +# check for explicit feed link +page_ext=`echo "$content" | grep -Po '(?<=)' | head -1 | tr '\0' '\n'` +page_ext=${page_ext##*href=\"} + +# if explicit feed link not found (article, not author page), truncate post URL to get author URL +if [[ "$page_ext" == "" ]] +then + # check for invalid link that cannot be shortened + # I don't think this is necessary, but just in case + if [[ "${url:0:8}" != "https://" && "${url:0:7}" != "http://" ]] && [[ "${url%%/}" == */* ]] || [[ "${url%%/}" == http*://*/* ]] + then + # truncate tailing slash (if applicable) + rss=${url%%/} + + # truncate last item + rss=${rss%/*} + + # add /feed/ + page_ext=${rss}/feed/ + fi +fi diff --git a/scripts/page-extractors/youtube b/scripts/page-extractors/youtube new file mode 100644 index 0000000..10eb1ba --- /dev/null +++ b/scripts/page-extractors/youtube @@ -0,0 +1,19 @@ +# if page is a channel page, use canonical link to determine channel id +try1=`echo "$content" | grep -Po '(?<=)'` +if [[ -n "$try1" ]]; then + channel_id="$try1" + +else + # else (e.g., video page) extract just channel id from metadata + try2=`echo "$content" | grep -Po '(?<="channelId":").+?(?=")' | head -1` + if [[ -n "$try2" ]]; then + channel_id="$try2" + fi +fi + +# if channel id successfully extracted +if [[ -n ${channel_id} ]] +then + rss="https://www.youtube.com/feeds/videos.xml?channel_id=${channel_id}" + page_ext=$rss +fi diff --git a/scripts/update b/scripts/update new file mode 100644 index 0000000..79b4330 --- /dev/null +++ b/scripts/update @@ -0,0 +1,12 @@ +# must be able to download a new version +if [[ ! -O .. && $EUID -ne 0 ]] +then + error "Please run as root or the owner of this directory." + exit +fi + +# if it's the git version, just git pull +if [[ -d .git ]] +then + git pull +fi diff --git a/scripts/url-extractors/chirbit b/scripts/url-extractors/chirbit new file mode 100644 index 0000000..e21e7ac --- /dev/null +++ b/scripts/url-extractors/chirbit @@ -0,0 +1,16 @@ +# can only extract feed from URL if it's chirbit.com +if [[ $url == *"chirbit.com/"* ]] +then + # get username (cut off https://www.chirbit.com/ from front) + username=${url##*chirbit.com/} + + # cut off any extra stuff from end + username=${username%%/*} + + if [[ -n $username ]] + then + # prepend chirbit URL and append /rss to form feed + rss="https://www.chirbit.com/${username}/rss" + url_ext=$rss + fi +fi diff --git a/scripts/url-extractors/deviantart b/scripts/url-extractors/deviantart new file mode 100644 index 0000000..22b3d7f --- /dev/null +++ b/scripts/url-extractors/deviantart @@ -0,0 +1,11 @@ +# get username (cut off https://www.deviantart.com/ from front) +username=${url##*deviantart.com/} + +# cut off any extra stuff from end +username=${username%%/*} + +if [[ -n $username ]] +then + rss="https://backend.deviantart.com/rss.xml?type=deviation&q=by%3A${username}+sort%3Atime+meta%3Aall" + url_ext=$rss +fi diff --git a/scripts/url-extractors/hugo b/scripts/url-extractors/hugo new file mode 100644 index 0000000..d5f215e --- /dev/null +++ b/scripts/url-extractors/hugo @@ -0,0 +1,7 @@ +determine_protocol +get_domain + +if [[ -n "$domain" ]] +then + url_ext="${protocol}${domain}/index.xml" +fi diff --git a/scripts/url-extractors/invidious b/scripts/url-extractors/invidious new file mode 100644 index 0000000..902890b --- /dev/null +++ b/scripts/url-extractors/invidious @@ -0,0 +1,39 @@ +# determine whether HTTP or HTTPS +# Tor instances may not use HTTPS +determine_protocol + +get_domain + +instance=${protocol}${domain} + +# get feed if able +channel_id="" +list="" +if [[ $url == *"/channel/"* ]] +then + channel_id=${url#*/channel/} +# Invidious just redirects /user/ to /channel/ anyway +elif [[ $url == *"/user/"* ]] +then + channel_id=${url#*/user/} +# playlist +elif [[ $url == *"&list="* ]] +then + list=${url#*&list=} + list=${list%%&*} +fi + +# trim extra arguments +channel_id=${channel_id%%\?*} +channel_id=${channel_id%%\&*} + +if [[ -n $channel_id ]] +then + channel_id=${channel_id%%/*} + rss="${instance}/feed/channel/${channel_id}" + url_ext=$rss +elif [[ -n $list ]] +then + rss="${instance}/feed/playlist/${list}" + url_ext=$rss +fi diff --git a/scripts/url-extractors/nitter b/scripts/url-extractors/nitter new file mode 100644 index 0000000..8a4067d --- /dev/null +++ b/scripts/url-extractors/nitter @@ -0,0 +1,16 @@ +determine_protocol +get_domain + +instance=${protocol}${domain} + +# get username +username=${url##*//} +username=${username#*/} +username=${username%%/*} + +# get feed if able +if [[ -n $username ]] +then + rss="${instance}/${username}/rss" + url_ext=$rss +fi diff --git a/scripts/url-extractors/plume b/scripts/url-extractors/plume new file mode 100644 index 0000000..503b352 --- /dev/null +++ b/scripts/url-extractors/plume @@ -0,0 +1,11 @@ +determine_protocol +get_domain + +# user page +if [[ "$url" == *${domain}/@/* ]] +then + # Atom feed should be at domain/@/username/atom.xml + username=${url##*${domain}/@/} + username=${username%%/*} + url_ext="${protocol}${domain}/@/${username}/atom.xml" +fi diff --git a/scripts/url-extractors/reddit b/scripts/url-extractors/reddit new file mode 100644 index 0000000..8d490df --- /dev/null +++ b/scripts/url-extractors/reddit @@ -0,0 +1,6 @@ +# cut off trailing slash if present (to prevent duplicates) +url=${url%%/} + +# append /rss to form feed +rss=${url}/.rss +url_ext=$rss diff --git a/scripts/url-extractors/tumblr b/scripts/url-extractors/tumblr new file mode 100644 index 0000000..7e60ea2 --- /dev/null +++ b/scripts/url-extractors/tumblr @@ -0,0 +1,31 @@ +# not all Tumblr blogs support HTTPS +determine_protocol + +get_domain + +# require subdomain +if [[ $domain == "tumblr.com" ]] +then + error "Must be on a subdomain, e.g., username.tumblr.com" + fail +fi + +# cut off end of page thing that gets appended sometimes +page=${url%%'#_=_'} + +# cut off trailing slash if present (to prevent duplicates) +page=${page%%/} + +# strip domain +page=${page##*tumblr.com} +page=${page##/} + +# get rss +if [[ -n $page ]] +then + rss=${protocol}${domain}/${page}/rss +else + rss=${protocol}${domain}/rss +fi + +url_ext=$rss diff --git a/scripts/url-extractors/vimeo b/scripts/url-extractors/vimeo new file mode 100644 index 0000000..762e4ed --- /dev/null +++ b/scripts/url-extractors/vimeo @@ -0,0 +1,16 @@ +# only able to extract from URL if URL is user page +if [[ $url == *"vimeo.com/user"* ]] +then + # get username (cut off https://vimeo.com/user from front) + username=${url##*vimeo.com/user} + + # cut off any extra stuff from end + username=${username%%/*} + + if [[ -n $username ]] + then + # prepend vimeo URL and append /rss to form feed + rss="https://vimeo.com/user${username}/videos/rss" + url_ext=$rss + fi +fi diff --git a/scripts/url-extractors/youtube b/scripts/url-extractors/youtube new file mode 100644 index 0000000..a4e1df8 --- /dev/null +++ b/scripts/url-extractors/youtube @@ -0,0 +1,23 @@ +if [[ $url == *"youtube.com/channel/"* ]] +then + channel_id=${url#*youtube.com/channel/} + channel_id=${channel_id%%/*} + channel_id=${channel_id%%\?*} + channel_id=${channel_id%%\&*} + rss="https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id" + url_ext=$rss +elif [[ $url == *"youtube.com/user/"* ]] +then + username=${url#*youtube.com/user/} + username=${username%%/*} + username=${username%%\?*} + username=${username%%\&*} + rss="https://www.youtube.com/feeds/videos.xml?user=$username" + url_ext=$rss +elif [[ $url == *"youtube.com/playlist/?list="* || $url == *"youtube.com/"*"&list="* ]] +then + list=${url#*list=} + list=${list%%&*} + rss="https://www.youtube.com/feeds/videos.xml?playlist_id=$list" + url_ext=$rss +fi diff --git a/templates/config b/templates/config new file mode 100644 index 0000000..3aad8ec --- /dev/null +++ b/templates/config @@ -0,0 +1,15 @@ +## Sample config file +## Uncomment lines by removing the # to use them. + +## Run in non-network mode (only try to determine feed from URL, do not download the page) +# -n + +## Use SOCKS5 proxy on localhost:9150 +# -p socks5h://localhost:9150 + +## Run in quiet mode (do not show output from curl) +# -q + +## Pretend to be Tor Browser to evade Cloudflare blocks while using Tor +## NOTE: This option does NOT itself set a Tor proxy. Please do so with -p. +# -t