如何比较所有RSS feed的所有标题并删除重复项? [英] How can I compare all the titles of all RSS feeds and delete duplicates?

查看:77
本文介绍了如何比较所有RSS feed的所有标题并删除重复项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以比较ALL TITLES in ALL RSS FEEDS并删除重复项.

I'm wondering if there is a way to compare ALL TITLES in ALL RSS FEEDS and delete the duplicates.

我阅读了很多RSS Feed,很明显,很多人交叉发布到多个论坛,然后我最终多次看到相同的RSS Feed.

I read through a lot of RSS Feeds, and it's obvious that a lot of people cross-post to several forums, and then I end up seeing the same RSS Feed multiple times.

我认为脚本看起来像这样,但是似乎并没有删除重复对象.....

I think the script will look something like this, but it doesn't seem to delete dupes.....

Option Explicit
Public Sub DupeRSS()
    Dim olNs As Outlook.NameSpace
    Dim RSS_Folder As Outlook.MAPIFolder

    Set olNs = Application.GetNamespace("MAPI")
    Set RSS_Folder = olNs.GetDefaultFolder(olFolderRssFeeds)

    'Process Current Folder
    Example RSS_Folder
End Sub
Public Sub Example(ByVal ParentFolder As Outlook.MAPIFolder)
    Dim itm As Object, itms As Items, dupes As Object, i As Long, k As Variant

    Set dupes = CreateObject("Scripting.Dictionary")
    Set itms = ParentFolder.Items

    For i = itms.Folders.Count To 1 Step -1
        Set itm = itms(i)
        If TypeOf itm Is PostItem Then
            If dupes.Exists(itm.Subject) Then itm.Delete Else dupes(itm.Subject) = 0
        Else
            Example itm     'Recursive call for Folders
        End If
    Next i

    'Show dictionary items
    If dupes.Count > 0 Then
        For Each k In dupes
            Debug.Print k
        Next
    End If

    Set itm = Nothing:  Set itms = Nothing: Set dupes = Nothing
End Sub

谢谢大家!

推荐答案

也许这是您要尝试的操作,下面的代码将所有Items主题行保存/添加到集合中,然后继续搜索多个文件夹然后,如果发现重复则删除-

Option Explicit
Public Sub DupeRSS()
    Dim olNs As Outlook.NameSpace
    Dim RSS_Folder As Outlook.MAPIFolder
    Dim DupItem As Object

    Set DupItem = CreateObject("Scripting.Dictionary")
    Set olNs = Application.GetNamespace("MAPI")
    Set RSS_Folder = olNs.GetDefaultFolder(olFolderRssFeeds)

'   // Process Current Folder
    Example RSS_Folder, DupItem
End Sub
Public Sub Example(ByVal ParentFolder As Outlook.MAPIFolder, _
                   ByVal DupItem As Object)
    Dim Folder As Outlook.MAPIFolder
    Dim Item As Object
    Dim Items As Items
    Dim i As Long

    Set Items = ParentFolder.Items
    Debug.Print ParentFolder.Name

    For i = Items.Count To 1 Step -1
        DoEvents

        If TypeOf Items(i) Is PostItem Then
            Set Item = Items(i)
            If DupItem.Exists(Item.Subject) Then
                Debug.Print Item.Subject ' Print on Immediate Window
                Debug.Print TypeName(Item) ' Print on Immediate Window
                Item.Delete
            Else
                DupItem.Add Item.Subject, 0
                Debug.Print DupItem.Count, Item.Subject
            End If
        End If

    Next i

'   // Recurse through subfolders
    If ParentFolder.Folders.Count > 0 Then
        For Each Folder In ParentFolder.Folders
            Example Folder, DupItem
            Debug.Print Folder.Name
        Next
    End If

    Set Folder = Nothing
    Set Item = Nothing
    Set Items = Nothing
End Sub

这篇关于如何比较所有RSS feed的所有标题并删除重复项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆