Compare commits

...

2 commits

Author SHA1 Message Date
d78fa371e9 fix: handle navigation endpoints for shorts (reelWatchEndpoint)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-08-04 16:15:04 +02:00
43ef8d15c4 feat: add build_with_client method to RustyPipeBuilder
fix: create data dir if it doesn't exist
2023-08-04 15:14:55 +02:00
3 changed files with 11 additions and 3 deletions

View file

@ -393,7 +393,7 @@ async fn main() {
let mut storage_dir = dirs::data_dir().expect("no data dir"); let mut storage_dir = dirs::data_dir().expect("no data dir");
storage_dir.push("rustypipe"); storage_dir.push("rustypipe");
_ = std::fs::create_dir(&storage_dir); std::fs::create_dir_all(&storage_dir).expect("could not create data dir");
let mut rp = RustyPipe::builder().storage_dir(storage_dir); let mut rp = RustyPipe::builder().storage_dir(storage_dir);
if cli.report { if cli.report {

View file

@ -458,7 +458,12 @@ impl RustyPipeBuilder {
/// Return a new, configured RustyPipe instance. /// Return a new, configured RustyPipe instance.
pub fn build(self) -> Result<RustyPipe, Error> { pub fn build(self) -> Result<RustyPipe, Error> {
let mut client_builder = ClientBuilder::new() self.build_with_client(ClientBuilder::new())
}
/// Return a new, configured RustyPipe instance using a Reqwest client builder.
pub fn build_with_client(self, mut client_builder: ClientBuilder) -> Result<RustyPipe, Error> {
client_builder = client_builder
.user_agent(self.user_agent.unwrap_or_else(|| DEFAULT_UA.to_owned())) .user_agent(self.user_agent.unwrap_or_else(|| DEFAULT_UA.to_owned()))
.gzip(true) .gzip(true)
.brotli(true) .brotli(true)

View file

@ -15,7 +15,10 @@ pub(crate) struct ResolvedUrl {
#[serde(untagged)] #[serde(untagged)]
pub(crate) enum NavigationEndpoint { pub(crate) enum NavigationEndpoint {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
Watch { watch_endpoint: WatchEndpoint }, Watch {
#[serde(alias = "reelWatchEndpoint")]
watch_endpoint: WatchEndpoint,
},
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
Browse { Browse {
browse_endpoint: BrowseEndpoint, browse_endpoint: BrowseEndpoint,