Compare commits

..

10 Commits

Author SHA1 Message Date
Paul van Tilburg 51c3874820
Bump the version to 0.4.0
Check Details
Lints Details
2023-03-24 19:25:52 +01:00
Paul van Tilburg fd4e1b00a1
Update the changelog 2023-03-24 19:24:13 +01:00
Paul van Tilburg bae34b6858
Bump dependencies on cached and youtube_dl 2023-03-24 19:20:55 +01:00
Paul van Tilburg 501bd9329c
Cargo update; fixes several security advisories
Fixes RUSTSEC-2021-0145, RUSTSEC-2020-0016. RUSTSEC-2023-0001,
RUSTSEC-2023-0005, RUSTSEC-2023-0018. RUSTSEC-2023-0022,
RUSTSEC-2023-0023 and RUSTSEC-2023-0024.
2023-03-24 19:18:08 +01:00
Paul van Tilburg 81979cd5e0
Update to Rocket 0.5.0-rc.3 2023-03-24 19:17:00 +01:00
Paul van Tilburg 8e4045572c
Add Gitea Actions workflow for cargo
Check Details
Lints Details
2023-03-21 11:54:58 +01:00
Paul van Tilburg 83d025c785
Bump the dependency on ytextract (closes: #14)
This fixes the issue where JSON cannot be serialized due to changes
in YouTube (a new player UI button in particular).
2023-01-30 19:53:25 +01:00
Paul van Tilburg 7f1120fd47
Select MP4 audio streams only (experimental)
The filter used to select the stream with the highest bitrate, but this
may result in a stream with a codec/container that is not supported by
all podcast clients, such as WEBM. Select the (almost always available)
highest stream using the MP4 container instead.
2023-01-29 14:27:47 +01:00
Paul van Tilburg 371b758962 Strip parameters from MIME types
Some podcast clients are scared of them and they are not really
necessary either.
2022-12-31 14:32:58 +01:00
Paul van Tilburg 2cd756254b
Fix typo 2022-12-30 11:17:30 +01:00
6 changed files with 673 additions and 827 deletions

View File

@ -0,0 +1,83 @@
name: "Check, Test and Lint Using Cargo"
on:
- push
- pull_request
- workflow_dispatch
jobs:
check:
name: Check
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Run cargo check
uses: https://github.com/actions-rs/cargo@v1
with:
command: check
# TODO: Add a test suite first!
# test:
# name: Test Suite
# runs-on: debian-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v3
#
# - name: Install stable toolchain
# uses: https://github.com/actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
#
# - name: Use sparse Cargo index for crates.io
# run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
#
# - name: Run cargo test
# uses: https://github.com/actions-rs/cargo@v1
# with:
# command: test
# args: --all-features
lints:
name: Lints
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Run cargo fmt
uses: https://github.com/actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: https://github.com/actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

View File

@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.4.0] - 2023-03-24
### Added
* Add Gitea Actions workflow for cargo
### Changed
* Update dependencies on `cached` and `youtube_dl`
* Update to `rocket` version 0.5.0-rc.3
* Select MP4 audio streams only (experimental)
* Remove parameters from MIME types to prevent clients tripping over them
### Fixed
* Bump the dependency on `ytextract` (#14)
* Fix typo in the documentation
## [0.3.0] - 2022-12-24
### Added
@ -56,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Initial release.
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.3.0...HEAD
[0.1.0]: https://git.luon.net/paul/podbringer/commits/tag/v0.1.0
[0.2.0]: https://git.luon.net/paul/podbringer/compare/v0.1.0..v0.2.0
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.4.0...HEAD
[0.4.0]: https://git.luon.net/paul/podbringer/compare/v0.3.0..v0.4.0
[0.3.0]: https://git.luon.net/paul/podbringer/compare/v0.2.0..v0.3.0
[0.2.0]: https://git.luon.net/paul/podbringer/compare/v0.1.0..v0.2.0
[0.1.0]: https://git.luon.net/paul/podbringer/commits/tag/v0.1.0

1361
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "podbringer"
version = "0.3.0"
version = "0.4.0"
authors = ["Paul van Tilburg <paul@luon.net>"]
edition = "2021"
description = "Web service that provides podcasts for services that don't offer them (anymore)"
@ -9,18 +9,18 @@ license = "MIT"
[dependencies]
async-trait = "0.1.57"
cached = { version = "0.41.0", features = ["async"] }
cached = { version = "0.42.0", features = ["async"] }
chrono = { version = "0.4.19", features = ["serde"] }
enum_dispatch = "0.3.8"
mime-db = "1.6.0"
reqwest = { version = "0.11.10", features = ["json"] }
rocket = { version = "0.5.0-rc.2", features = ["json"] }
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
rss = "2.0.1"
thiserror = "1.0.31"
url = { version = "2.2.2", features = ["serde"] }
youtube_dl = { version = "0.7.0", features = ["tokio"] }
ytextract = "0.11.1"
youtube_dl = { version = "0.8.0", features = ["tokio"] }
ytextract = "0.11.2"
[package.metadata.deb]
maintainer = "Paul van Tilburg <paul@luon.net>"

View File

@ -65,7 +65,7 @@ provide the limit in the URL by setting the `limit` parameter.
For example, to get up until 1000 items the URL becomes:
```text
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband?limit=1000`
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband?limit=1000
```
### Service: Mixcloud

View File

@ -182,10 +182,13 @@ impl From<YouTubeVideoWithStream> for Item {
) -> Self {
let id = video.id().to_string();
let mime_type = stream.mime_type().to_string();
// Ignore everything from MIME type parameter seperator on for extension look-up.
let mime_sep = mime_type.find(';').unwrap_or(mime_type.len());
let extension = mime_db::extension(&mime_type[..mime_sep]).unwrap_or_default();
// Strip parameters from MIME type; some clients are scared of them and they are no
// necessary.
let mut mime_type = stream.mime_type().to_string();
if let Some(sep_idx) = mime_type.find(';') {
mime_type.truncate(sep_idx);
}
let extension = mime_db::extension(&mime_type).unwrap_or_default();
let file = PathBuf::from(&id).with_extension(extension);
let enclosure = Enclosure {
file,
@ -305,7 +308,9 @@ async fn fetch_stream(
.streams()
.await
.ok()?
.filter(|v| v.is_audio())
// Select the well-supported, almost always available MP4 container format with
// only an audio stream and then the one with the highest bitrate.
.filter(|v| v.is_audio() && v.mime_type().contains("mp4"))
.max_by_key(|v| v.bitrate())?;
let content_length = stream.content_length().await.ok()?;
@ -334,7 +339,9 @@ async fn retrieve_redirect_url(client: &Client, video_id: &str) -> Result<String
let stream = video
.streams()
.await?
.filter(|v| v.is_audio())
// Select the well-supported, almost always available MP4 container format with only an
// audio stream and then the one with the highest bitrate.
.filter(|v| v.is_audio() && v.mime_type().contains("mp4"))
.max_by_key(|v| v.bitrate())
.ok_or(Error::NoRedirectUrlFound)?;