@@ -31,7 +31,7 @@ internal sealed class PatreonPageCrawler : IPageCrawler
31
31
32
32
//TODO: Research possibility of not hardcoding this string
33
33
private const string CrawlStartUrl = "https://www.patreon.com/api/posts?" +
34
- "include=user%2Cattachments %2Ccampaign%2Cpoll.choices%2Cpoll.current_user_responses.user%2Cpoll.current_user_responses.choice%2Cpoll.current_user_responses.poll%2Caccess_rules.tier.null%2Cimages.null%2Caudio.null" +
34
+ "include=user%2Cattachments_media %2Ccampaign%2Cpoll.choices%2Cpoll.current_user_responses.user%2Cpoll.current_user_responses.choice%2Cpoll.current_user_responses.poll%2Caccess_rules.tier.null%2Cimages.null%2Caudio.null" +
35
35
"&fields[post]=change_visibility_at%2Ccomment_count%2Ccontent%2Ccurrent_user_can_delete%2Ccurrent_user_can_view%2Ccurrent_user_has_liked%2Cembed%2Cimage%2Cis_paid%2Clike_count%2Cmin_cents_pledged_to_view%2Cpost_file%2Cpost_metadata%2Cpublished_at%2Cpatron_count%2Cpatreon_url%2Cpost_type%2Cpledge_url%2Cthumbnail_url%2Cteaser_text%2Ctitle%2Cupgrade_url%2Curl%2Cwas_posted_by_campaign_owner" +
36
36
"&fields[user]=image_url%2Cfull_name%2Curl" +
37
37
"&fields[campaign]=show_audio_post_download_links%2Cavatar_photo_url%2Cearnings_visibility%2Cis_nsfw%2Cis_monthly%2Cname%2Curl" +
@@ -126,7 +126,7 @@ private async Task<ParsingResult> ParsePage(string json)
126
126
{
127
127
_logger . Warn ( $ "[{ jsonEntry . Id } ] Current user cannot view this post") ;
128
128
129
- string [ ] skippedAttachments = jsonEntry . Relationships . Attachments ? . Data . Select ( x => x . Id ) . ToArray ( ) ?? new string [ 0 ] ;
129
+ string [ ] skippedAttachments = jsonEntry . Relationships . AttachmentsMedia ? . Data . Select ( x => x . Id ) . ToArray ( ) ?? new string [ 0 ] ;
130
130
string [ ] skippedMedia = jsonEntry . Relationships . Images ? . Data . Select ( x => x . Id ) . ToArray ( ) ?? new string [ 0 ] ;
131
131
_logger . Debug ( $ "[{ jsonEntry . Id } ] Adding { skippedAttachments . Length } attachments and { skippedMedia . Length } media items to skipped list") ;
132
132
@@ -225,20 +225,20 @@ await File.WriteAllTextAsync(
225
225
226
226
_logger . Debug ( $ "[{ jsonEntry . Id } ] Scanning attachment data") ;
227
227
//Attachments
228
- if ( jsonEntry . Relationships . Attachments ? . Data != null )
228
+ if ( jsonEntry . Relationships . AttachmentsMedia ? . Data != null )
229
229
{
230
- foreach ( var attachment in jsonEntry . Relationships . Attachments . Data )
230
+ foreach ( var attachment in jsonEntry . Relationships . AttachmentsMedia . Data )
231
231
{
232
232
_logger . Debug ( $ "[{ jsonEntry . Id } A-{ attachment . Id } ] Scanning attachment") ;
233
- if ( attachment . Type != "attachment " ) //sanity check
233
+ if ( attachment . Type != "media " ) //sanity check
234
234
{
235
235
string msg = $ "Invalid attachment type for { attachment . Id } !!!";
236
236
_logger . Fatal ( $ "[{ jsonEntry . Id } ] { msg } ") ;
237
237
OnCrawlerMessage ( new CrawlerMessageEventArgs ( CrawlerMessageType . Error , msg , jsonEntry . Id ) ) ;
238
238
continue ;
239
239
}
240
240
241
- var attachmentData = jsonRoot . Included . FirstOrDefault ( x => x . Type == "attachment " && x . Id == attachment . Id ) ;
241
+ var attachmentData = jsonRoot . Included . FirstOrDefault ( x => x . Type == "media " && x . Id == attachment . Id ) ;
242
242
243
243
if ( attachmentData == null )
244
244
{
@@ -249,8 +249,8 @@ await File.WriteAllTextAsync(
249
249
}
250
250
251
251
PatreonCrawledUrl subEntry = ( PatreonCrawledUrl ) entry . Clone ( ) ; ;
252
- subEntry . Url = attachmentData . Attributes . Url ;
253
- subEntry . Filename = attachmentData . Attributes . Name ;
252
+ subEntry . Url = attachmentData . Attributes . DownloadUrl ;
253
+ subEntry . Filename = attachmentData . Attributes . FileName ;
254
254
subEntry . UrlType = PatreonCrawledUrlType . PostAttachment ;
255
255
subEntry . FileId = attachmentData . Id ;
256
256
crawledUrls . Add ( subEntry ) ;
0 commit comments