Пример #1
0
        /// <inheritdoc />
        protected override async Task ProcessRecordAsync(CancellationToken cancellationToken)
        {
            var pages   = GetPages();
            var options = PageQueryOptions.None;

            if (Content)
            {
                options |= PageQueryOptions.FetchContent;
            }
            if (ResolveRedirects)
            {
                options |= PageQueryOptions.ResolveRedirects;
            }
            var provider = MediaWikiHelper.QueryProviderFromOptions(options);

            if (Extract | GeoCoordinate)
            {
                var provider1 = WikiPageQueryProvider.FromOptions(options);
                if (Extract)
                {
                    provider1.Properties.Add(new ExtractsPropertyProvider
                    {
                        AsPlainText      = true,
                        IntroductionOnly = true,
                        MaxSentences     = 1,
                    });
                }
                if (GeoCoordinate)
                {
                    provider1.Properties.Add(new GeoCoordinatesPropertyProvider());
                }
                provider = provider1;
            }
            await pages.RefreshAsync(provider, cancellationToken);

            WriteObject(pages, true);
        }
Пример #2
0
 /// <inheritdoc cref="FetchRevisionsAsync(WikiSite,IEnumerable{int},IWikiPageQueryProvider,CancellationToken)"/>
 public static IAsyncEnumerable <Revision> FetchRevisionsAsync(WikiSite site, IEnumerable <int> revisionIds, PageQueryOptions options, CancellationToken cancellationToken)
 {
     return(FetchRevisionsAsync(site, revisionIds, MediaWikiHelper.QueryProviderFromOptions(options), cancellationToken));
 }
 /// <summary>
 /// Asynchronously generates the sequence of pages.
 /// </summary>
 public IAsyncEnumerable <WikiPage> EnumPagesAsync(PageQueryOptions options)
 {
     return(EnumPagesAsync(MediaWikiHelper.QueryProviderFromOptions(options)));
 }
 /// <summary>
 /// Asynchornously generate the sequence of pages.
 /// </summary>
 public virtual IAsyncEnumerable <WikiPage> EnumPagesAsync()
 {
     return(EnumPagesAsync(MediaWikiHelper.QueryProviderFromOptions(PageQueryOptions.None)));
 }
Пример #5
0
 /// <inheritdoc cref="RefreshAsync(IEnumerable{WikiPage},IWikiPageQueryProvider,CancellationToken)"/>
 public static Task RefreshAsync(this IEnumerable <WikiPage> pages, PageQueryOptions options, CancellationToken cancellationToken)
 {
     return(RequestHelper.RefreshPagesAsync(pages, MediaWikiHelper.QueryProviderFromOptions(options), cancellationToken));
 }
Пример #6
0
 /// <inheritdoc cref="RefreshAsync(IWikiPageQueryProvider, CancellationToken)"/>
 public Task RefreshAsync(PageQueryOptions options, CancellationToken cancellationToken)
 {
     return(RefreshAsync(MediaWikiHelper.QueryProviderFromOptions(options), cancellationToken));
 }