Compare commits

..

2 commits

Author SHA1 Message Date
49fe76823e
chore(release): release rustypipe v0.1.2
Some checks failed
Release / Release (push) Has been cancelled
CI / Test (push) Has been cancelled
2024-03-26 21:22:08 +01:00
180dd9891a
fix: correctly parse subscriber count with new channel header
It looks like A/B test 12 has changed the text field order for the subscriber count slightly. Support was added to correctly parse both variants
2024-03-26 21:19:51 +01:00
4 changed files with 15908 additions and 10 deletions

View file

@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [v0.1.2](https://code.thetadev.de/ThetaDev/rustypipe/compare/rustypipe/v0.1.1..v0.1.2) - 2024-03-26
### 🐛 Bug Fixes
- Correctly parse subscriber count with new channel header - ([180dd98](https://code.thetadev.de/ThetaDev/rustypipe/commit/180dd9891a14b4da9f130a73d73aecc3822fce2f))
## [v0.1.1](https://code.thetadev.de/ThetaDev/rustypipe/compare/rustypipe-cli/v0.1.0..v0.1.1) - 2024-03-26 ## [v0.1.1](https://code.thetadev.de/ThetaDev/rustypipe/compare/rustypipe-cli/v0.1.0..v0.1.1) - 2024-03-26
### 🐛 Bug Fixes ### 🐛 Bug Fixes

View file

@ -480,16 +480,16 @@ fn map_channel(
response::channel::Header::PageHeaderRenderer(header) => { response::channel::Header::PageHeaderRenderer(header) => {
let hdata = header.content.page_header_view_model; let hdata = header.content.page_header_view_model;
// channel handle - subscriber count - video count // channel handle - subscriber count - video count
let subscriber_count = hdata let md_rows = hdata.metadata.content_metadata_view_model.metadata_rows;
.metadata let sub_part = if md_rows.len() > 1 {
.content_metadata_view_model md_rows.get(1).and_then(|md| md.metadata_parts.first())
.metadata_rows } else {
.first() md_rows.first().and_then(|md| md.metadata_parts.get(1))
.and_then(|md| { };
md.metadata_parts.get(1).and_then(|t| { let subscriber_count = sub_part.and_then(|t| {
util::parse_large_numstr_or_warn::<u64>(&t.text, lang, &mut warnings) util::parse_large_numstr_or_warn::<u64>(&t.text, lang, &mut warnings)
}) });
});
Channel { Channel {
id: metadata.external_id, id: metadata.external_id,
name: metadata.title, name: metadata.title,
@ -720,6 +720,7 @@ mod tests {
#[case::shorts("shorts", "UCh8gHdtzO2tXd593_bjErWg")] #[case::shorts("shorts", "UCh8gHdtzO2tXd593_bjErWg")]
#[case::livestreams("livestreams", "UC2DjFE7Xf11URZqWBigcVOQ")] #[case::livestreams("livestreams", "UC2DjFE7Xf11URZqWBigcVOQ")]
#[case::pageheader("shorts_20240129_pageheader", "UCh8gHdtzO2tXd593_bjErWg")] #[case::pageheader("shorts_20240129_pageheader", "UCh8gHdtzO2tXd593_bjErWg")]
#[case::pageheader2("videos_20240324_pageheader2", "UC2DjFE7Xf11URZqWBigcVOQ")]
fn map_channel_videos(#[case] name: &str, #[case] id: &str) { fn map_channel_videos(#[case] name: &str, #[case] id: &str) {
let json_path = path!(*TESTFILES / "channel" / format!("channel_{name}.json")); let json_path = path!(*TESTFILES / "channel" / format!("channel_{name}.json"));
let json_file = File::open(json_path).unwrap(); let json_file = File::open(json_path).unwrap();

File diff suppressed because it is too large Load diff