BinaryWorks.it Official Forum
Home
|
Profile
|
Active Topics
|
Members
|
Search
|
FAQ
All Forums
eXtreme Movie Manager 8, 9, 10 Forum
Scripts
IMDb API & Web Scraping
Note:
Only the poster of this message, and the Moderator can edit the message.
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
Habe mich nicht ganz klar ausgedrückt [:D] [code] List<AlternateTitle> alternateTitles = await Scraper.ScrapeAllAlternateTitles(imdbID); Companies? companies = await Scraper.ScrapeAllCompaniesAsync(imdbID); // 5 steps Connections? connections = await Scraper.ScrapeAllConnectionsAsync(imdbID); // 12 steps List<Dates> filmingDates = await Scraper.ScrapeAllFilmingDatesAsync(imdbID); [b][red]List<FilmingLocation> filmingLocations = await Scraper.ScrapeAllFilmingLocationsAsync(imdbID); LocationsPage? locationsPage = await Scraper.ScrapeLocationsPageAsync(imdbID);[/red][/b] List<ReleaseDate> releaseDates = await Scraper.ScrapeAllReleaseDatesAsync(imdbID); [/code] Hier hat mich nur gewundert, warum zuerst die Liste mit den filmingLocatgions kommt und danach noch mal LocationsPage. CountryLocale [^] Hatte das noch nicht getestet [code] sbExport.AppendLine("---Production Distributors"); companies.Distribution = companies.Distribution.OrderBy(x => x.Countries).ToList(); foreach (Company company in companies.Distribution) { if (company.Countries.Contains("DE")) { sbExport.AppendLine($"{company.Countries} {company.Name} {company.YearFrom}}"); } } [/code] Und am Ende: [code] sbExport.AppendLine($"---Connections FollowedBy"); foreach (Connection connection in connections.FollowedBy) { sbExport.AppendLine($"{connection.AssociatedTitle.URL}|{connection.AssociatedTitle.LocalizedTitle} ({connection.AssociatedTitle.YearFrom})"); } [/code] Wie baue ich am Besten eine äußere foreach-Schleife ein? In der Art wie "foreach connections.categories {...}" Um nicht für jede Kategorie den gleichen Code schreiben zu müssen. Das ist mein bisheriger Code: [code] // --- daten aufbereiten -------------------------------------------------------------------- StringBuilder sbExport = new StringBuilder(); sbExport.AppendLine("---Alternate Titles"); alternateTitles = alternateTitles.OrderBy(x => x.Country?.ID).ToList(); foreach (AlternateTitle alternateTitle in alternateTitles) { sbExport.AppendLine($"{alternateTitle.Country?.ID}: {alternateTitle.Title}"); } // ... sbExport.AppendLine("---Release Dates"); releaseDates = releaseDates.OrderBy(x => x.Country?.ID).ToList(); foreach (ReleaseDate releaseDate in releaseDates) { if (releaseDate.Date != null) { sbExport.AppendLine($"{releaseDate.Country?.ID}: {releaseDate.Date.Value.ToString("dd.MM.yyyy")}"); } } // ... sbExport.AppendLine("---Filming Locations"); foreach (FilmingLocation filmingLocation in filmingLocations) { sbExport.AppendLine($"{filmingLocation.Address}"); } // ... sbExport.AppendLine("---Production Companies"); foreach (Company company in companies.Production) { sbExport.AppendLine($"{company.Name}"); } [b][red]// ... Die IF-Routine funktioniert nicht !!![/red][/b] sbExport.AppendLine("---Production Distributors"); foreach (Company company in companies.Distribution) { [b][red]if (company.Countries[0] == "Germany")[/red][/b] { sbExport.AppendLine($"{company.Countries[0]} - {company.Name} ({company.YearFrom})"); } } // ... sbExport.AppendLine($"---Connections FollowedBy"); foreach (Connection connection in connections.FollowedBy) { sbExport.AppendLine($"{connection.AssociatedTitle.URL}|{connection.AssociatedTitle.LocalizedTitle} ({connection.AssociatedTitle.YearFrom})"); } // ... // --- Daten exportieren -------------------------------------------------------------------- string path = $"{tbxFolder.Text}\\{imdbID}.txt"; File.WriteAllText(path, sbExport.ToString()); } [/code]
Check here to include your profile signature.
BinaryWorks.it Official Forum
© Binaryworks.it
Generated in 0.03 sec.