用Python的Django框架来制作一个RSS阅读器

发表于 5年以前  | 总阅读数:1263 次

Django带来了一个高级的聚合生成框架,它使得创建RSS和Atom feeds变得非常容易。

什么是RSS? 什么是Atom?

RSS和Atom都是基于XML的格式,你可以用它来提供有关你站点内容的自动更新的feed。 了解更多关于RSS的可以访问 http://www.whatisrss.com/, 更多Atom的信息可以访问 http://www.atomenabled.org/.

想创建一个联合供稿的源(syndication feed),所需要做的只是写一个简短的python类。 你可以创建任意多的源(feed)。

高级feed生成框架是一个默认绑定到/feeds/的视图,Django使用URL的其它部分(在/feeds/之后的任何东西)来决定输出 哪个feed Django uses the remainder of the URL (everything after /feeds/ ) to determine which feed to return.

要创建一个 sitemap,你只需要写一个 Sitemap 类然后配置你的URLconf指向它。
初始化

为了在您的Django站点中激活syndication feeds, 添加如下的 URLconf:


    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
      {'feed_dict': feeds}
    ),

这一行告诉Django使用RSS框架处理所有的以 "feeds/" 开头的URL. ( 你可以修改 "feeds/" 前缀以满足您自己的要求. )

URLConf里有一行参数: {'feed_dict': feeds},这个参数可以把对应URL需要发布的feed内容传递给 syndication framework

特别的,feed_dict应该是一个映射feed的slug(简短URL标签)到它的Feed类的字典 你可以在URL配置本身里定义feed_dict,这里是一个完整的例子 You can define the feed_dict in the URLconf itself. Here's a full example URLconf:


    from django.conf.urls.defaults import *
    from mysite.feeds import LatestEntries, LatestEntriesByCategory

    feeds = {
      'latest': LatestEntries,
      'categories': LatestEntriesByCategory,
    }

    urlpatterns = patterns('',
      # ...
      (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
        {'feed_dict': feeds}),
      # ...
    )

前面的例子注册了两个feed:

  1. LatestEntries``表示的内容将对应到``feeds/latest/ .
  2. LatestEntriesByCategory的内容将对应到feeds/categories/ .

以上的设定完成之后,接下来需要自己定义 Feed 类

一个 Feed 类是一个简单的python类,用来表示一个syndication feed. 一个feed可能是简单的 (例如一个站点新闻feed,或者最基本的,显示一个blog的最新条目),也可能更加复杂(例如一个显示blog某一类别下所有条目的feed。 这里类别 category 是个变量).

Feed类必须继承django.contrib.syndication.feeds.Feed,它们可以在你的代码树的任何位置
一个简单的Feed


    This simple example describes a feed of the latest five blog entries for a given blog:

    from django.contrib.syndication.feeds import Feed
    from mysite.blog.models import Entry

    class LatestEntries(Feed):
      title = "My Blog"
      link = "/archive/"
      description = "The latest news about stuff."

      def items(self):
        return Entry.objects.order_by('-pub_date')[:5]

要注意的重要的事情如下所示:

  • 子类 django.contrib.syndication.feeds.Feed .
  • title , link , 和 description 对应一个标准 RSS 里的 , <link> , 和 <description> 标签.</li> <li>items() 是一个方法,返回一个用以包含在包含在feed的 <item> 元素里的 list 虽然例子里用Djangos database API返回的 NewsItem 对象, items() 不一定必须返回 model的实例 Although this example returns Entry objects using Django's database API, items() doesn't have to return model instances.</li> </ul> <p>还有一个步骤,在一个RSS feed里,每个(item)有一个(title),(link)和(description),我们需要告诉框架 把数据放到这些元素中 In an RSS feed, each <item> has a <title> , <link> , and <description> . We need to tell the framework what data to put into those elements.</p> <pre><code>如果要指定 <title> 和 <description> ,可以建立一个Django模板(见Chapter 4)名字叫 feeds/latest_title.html 和 feeds/latest_description.html ,后者是URLConf里为对应feed指定的 slug 。注意 .html 后缀是必须的。 Note that the .html extension is required. RSS系统模板渲染每一个条目,需要给传递2个参数给模板上下文变量:</code></pre> <ol> <li> <pre><code> obj : 当前对象 ( 返回到 items() 任意对象之一 )。</code></pre> </li> <li>site : 一个表示当前站点的 django.models.core.sites.Site 对象。 这对于 {{ site.domain }} 或者 {{ site.name }} 很有用。</li> </ol> <pre><code>如果你在创建模板的时候,没有指明标题或者描述信息,框架会默认使用 "{{ obj }}" ,对象的字符串表示。 (For model objects, this will be the __unicode__() method. 你也可以通过修改 Feed 类中的两个属性 title_template 和 description_template 来改变这两个模板的名字。 你有两种方法来指定 <link> 的内容。 Django 首先执行 items() 中每一项的 get_absolute_url() 方法。 如果该方法不存在,就会尝试执行 Feed 类中的 item_link() 方法,并将自身作为 item 参数传递进去。 get_absolute_url() 和 item_link() 都应该以Python字符串形式返回URL。 对于前面提到的 LatestEntries 例子,我们可以实现一个简单的feed模板。 latest_title.html 包括:</code></pre> <p>{{ obj.title }}</p> <pre><code>并且 latest_description.html 包含:</code></pre> <p>{{ obj.description }}</p> <pre><code>这真是 太 简单了!</code></pre> <p><strong>一个更复杂的Feed</strong></p> <p>框架通过参数支持更加复杂的feeds。</p> <p>For example, say your blog offers an RSS feed for every distinct tag you've used to categorize your entries. 如果为每一个单独的区域建立一个 Feed 类就显得很不明智。</p> <p>取而代之的方法是,使用聚合框架来产生一个通用的源,使其可以根据feeds URL返回相应的信息。</p> <p>Your tag-specific feeds could use URLs like this:</p> <pre><code>http://example.com/feeds/tags/python/ : Returns recent entries tagged with python http://example.com/feeds/tags/cats/ : Returns recent entries tagged with cats</code></pre> <p>固定的那一部分是 "beats" (区域)。</p> <p>举个例子会澄清一切。 下面是每个地区特定的feeds:</p> <pre><code> from django.core.exceptions import ObjectDoesNotExist from mysite.blog.models import Entry, Tag class TagFeed(Feed): def get_object(self, bits): # In case of "/feeds/tags/cats/dogs/mice/", or other such # clutter, check that bits has only one member. if len(bits) != 1: raise ObjectDoesNotExist return Tag.objects.get(tag=bits[0]) def title(self, obj): return "My Blog: Entries tagged with %s" % obj.tag def link(self, obj): return obj.get_absolute_url() def description(self, obj): return "Entries tagged with %s" % obj.tag def items(self, obj): entries = Entry.objects.filter(tags__id__exact=obj.id) return entries.order_by('-pub_date')[:30] </code></pre> <p>以下是RSS框架的基本算法,我们假设通过URL /rss/beats/0613/ 来访问这个类:</p> <pre><code>框架获得了URL /rss/beats/0613/ 并且注意到URL中的slug部分后面含有更多的信息。 它将斜杠("/" )作为分隔符,把剩余的字符串分割开作为参数,调用 Feed 类的 get_object() 方法。 在这个例子中,添加的信息是 ['0613'] 。对于 /rss/beats/0613/foo/bar/ 的一个URL请求, 这些信息就是 ['0613', 'foo', 'bar'] 。 get_object() 就根据给定的 bits 值来返回区域信息。 In this case, it uses the Django database API to retrieve the Tag . Note that get_object() should raise django.core.exceptions.ObjectDoesNotExist if given invalid parameters. 在 Beat.objects.get() 调用中也没有出现 try /except 代码块。 函数在出错时抛出 Beat.DoesNotExist 异常,而 Beat.DoesNotExist 是 ObjectDoesNotExist 异常的一个子类型。 为产生 <title> , <link> , 和 <description> 的feeds, Django使用 title() , link() , 和 description() 方法。 在上面的例子中,它们都是简单的字符串类型的类属性,而这个例子表明,它们既可以是字符串, 也可以是 方法。 对于每一个 title , link 和 description 的组合,Django使用以下的算法: 试图调用一个函数,并且以 get_object() 返回的对象作为参数传递给 obj 参数。 如果没有成功,则不带参数调用一个方法。 还不成功,则使用类属性。 最后,值得注意的是,这个例子中的 items() 使用 obj 参数。 对于 items 的算法就如同上面第一步所描述的那样,首先尝试 items(obj) , 然后是 items() ,最后是 items 类属性(必须是一个列表)。</code></pre> <p>Feed 类所有方法和属性的完整文档,请参考官方的Django文档 (http://www.djangoproject.com/documentation/0.96/syndication_feeds/) 。<br /> 指定Feed的类型</p> <p>默认情况下, 聚合框架生成RSS 2.0. 要改变这样的情况, 在 Feed 类中添加一个 feed_type 属性. To change that, add a feed_type attribute to your Feed class:</p> <pre><code> from django.utils.feedgenerator import Atom1Feed class MyFeed(Feed): feed_type = Atom1Feed </code></pre> <p>注意你把 feed_type 赋值成一个类对象,而不是类实例。 目前合法的Feed类型如表所示。 </p> <p><img src="https://codingsky.oss-cn-hangzhou.aliyuncs.com/cdn/codingsky/upload/img/blog/743c4e6c75930439d14d6b6b9c01a6a1.jpg" alt="2015722150842180.jpg \(705×179\)" /></p> <p><strong>闭包</strong></p> <p>为了指定闭包(例如,与feed项比方说MP3 feeds相关联的媒体资源信息),使用 item_enclosure_url , item_enclosure_length , 以及 item_enclosure_mime_type ,比如</p> <pre><code> from myproject.models import Song class MyFeedWithEnclosures(Feed): title = "Example feed with enclosures" link = "/feeds/example-with-enclosures/" def items(self): return Song.objects.all()[:30] def item_enclosure_url(self, item): return item.song_url def item_enclosure_length(self, item): return item.song_length item_enclosure_mime_type = "audio/mpeg" </code></pre> <p>当然,你首先要创建一个包含有 song_url 和 song_length (比如按照字节计算的长度)域的 Song 对象。<br /> <strong>语言</strong></p> <p>聚合框架自动创建的Feed包含适当的 <language> 标签(RSS 2.0) 或 xml:lang 属性(Atom). 他直接来自于您的 LANGUAGE_CODE 设置. This comes directly from your LANGUAGE_CODE setting.<br /> <strong>URLs</strong></p> <p>link 方法/属性可以以绝对URL的形式(例如, "/blog/" )或者指定协议和域名的URL的形式返回(例如 "http://www.example.com/blog/" )。如果 link 没有返回域名,聚合框架会根据 SITE_ID 设置,自动的插入当前站点的域信息。 (See Chapter 16 for more on SITE_ID and the sites framework.)</p> <p>Atom feeds需要 <link rel="self"> 指明feeds现在的位置。 The syndication framework populates this automatically.<br /> <strong>同时发布Atom and RSS</strong></p> <p>一些开发人员想 同时 支持Atom和RSS。 这在Django中很容易实现: 只需创建一个你的 feed 类的子类,然后修改 feed_type ,并且更新URLconf内容。 下面是一个完整的例子: Here's a full example:</p> <pre><code> from django.contrib.syndication.feeds import Feed from django.utils.feedgenerator import Atom1Feed from mysite.blog.models import Entry class RssLatestEntries(Feed): title = "My Blog" link = "/archive/" description = "The latest news about stuff." def items(self): return Entry.objects.order_by('-pub_date')[:5] class AtomLatestEntries(RssLatestEntries): feed_type = Atom1Feed </code></pre> <p>这是与之相对应那个的URLconf:</p> <pre><code> from django.conf.urls.defaults import * from myproject.feeds import RssLatestEntries, AtomLatestEntries feeds = { 'rss': RssLatestEntries, 'atom': AtomLatestEntries, } urlpatterns = patterns('', # ... (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), # ... ) </code></pre> </div> </div> </div> <div class="blockgap"></div> <div style="background-color:#fff;padding-top:8px;border-radius: 4px;padding-bottom:8px;"> <div style="margin-left:21px;"> <script type="text/javascript"> (function() { var s = "_" + Math.random().toString(36).slice(2); document.write('<div style="" id="' + s + '"></div>'); (window.slotbydup = window.slotbydup || []).push({ id: "u3790074", container: s }); })(); </script> </div> </div> <div class="blockgap"></div> <div class="sideblock"> <div class="block-title"><i style="font-size:1.8rem;" class="fab fa-audible"></i><span style="font-size:1.8rem;"> 相关推荐</span></div> <div class="block-body"> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn/img/2023-09-04/71a1bb7210e2f17f8e0e3e49647fbe46.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/219.html"> 刘强东夫妇:“移民美国”传言被驳斥 </a> </h3> <div class="tp-postitem-summary"> <p> 京东创始人刘强东和其妻子章泽天最近成为了互联网舆论关注的焦点。有关他们“移民美国”和在美国购买豪宅的传言在互联网上广泛传播。然而,京东官方通过微博发言人发布的消息澄清了这些传言,称这些言论纯属虚假信息和蓄意捏造。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >808次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/219.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/huwei.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/901.html"> 博主曝三大运营商,将集体采购百万台华为Mate60系列 </a> </h3> <div class="tp-postitem-summary"> <p> 日前,据博主“@超能数码君老周”爆料,国内三大运营商中国移动、中国电信和中国联通预计将集体采购百万台规模的华为Mate60系列手机。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >770次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/901.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/8/284.html"> ASML CEO警告:出口管制不是可行做法,不要“逼迫中国大陆创新” </a> </h3> <div class="tp-postitem-summary"> <p> 据报道,荷兰半导体设备公司ASML正看到美国对华遏制政策的负面影响。阿斯麦(ASML)CEO彼得·温宁克在一档电视节目中分享了他对中国大陆问题以及该公司面临的出口管制和保护主义的看法。彼得曾在多个场合表达了他对出口管制以及中荷经济关系的担忧。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>756次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/8/284.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/douyin.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/5/467.html"> 抖音中长视频App青桃更名抖音精选,字节再发力对抗B站 </a> </h3> <div class="tp-postitem-summary"> <p> 今年早些时候,抖音悄然上线了一款名为“青桃”的 App,Slogan 为“看见你的热爱”,根据应用介绍可知,“青桃”是一个属于年轻人的兴趣知识视频平台,由抖音官方出品的中长视频关联版本,整体风格有些类似B站。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >648次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/5/467.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn/img/2023-09-05/306e611a07fbb00c7022a7014b0b7f73"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/5/927.html"> 威马CDO:中国每百户家庭仅17户有车 </a> </h3> <div class="tp-postitem-summary"> <p> 日前,威马汽车首席数据官梅松林转发了一份“世界各国地区拥车率排行榜”,同时,他发文表示:中国汽车普及率低于非洲国家尼日利亚,每百户家庭仅17户有车。意大利世界排名第一,每十户中九户有车。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >589次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/5/927.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/526.html"> 研究发现维生素 C 等抗氧化剂会刺激癌症生长和转移 </a> </h3> <div class="tp-postitem-summary"> <p> 近日,一项新的研究发现,维生素 C 和 E 等抗氧化剂会激活一种机制,刺激癌症肿瘤中新血管的生长,帮助它们生长和扩散。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>449次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/526.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/apple.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/1/463.html"> 苹果据称正引入3D打印技术,用以生产智能手表的钢质底盘 </a> </h3> <div class="tp-postitem-summary"> <p> 据媒体援引消息人士报道,苹果公司正在测试使用3D打印技术来生产其智能手表的钢质底盘。消息传出后,3D系统一度大涨超10%,不过截至周三收盘,该股涨幅回落至2%以内。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >446次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/1/463.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn/img/2023-09-04/feaca95ded3028bc03a8da8a0e24a1a2"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/1044.html"> 千万级抖音网红秀才账号被封禁 </a> </h3> <div class="tp-postitem-summary"> <p> 9月2日,坐拥千万粉丝的网红主播“秀才”账号被封禁,在社交媒体平台上引发热议。平台相关负责人表示,“秀才”账号违反平台相关规定,已封禁。据知情人士透露,秀才近期被举报存在违法行为,这可能是他被封禁的部分原因。据悉,“秀才”年龄39岁,是安徽省亳州市蒙城县人,抖音网红,粉丝数量超1200万。他曾被称为“中老年... </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >445次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/1044.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/302.html"> 亚马逊股东起诉公司和贝索斯,称其在购买卫星发射服务时忽视了 SpaceX </a> </h3> <div class="tp-postitem-summary"> <p> 9月3日消息,亚马逊的一些股东,包括持有该公司股票的一家养老基金,日前对亚马逊、其创始人贝索斯和其董事会提起诉讼,指控他们在为 Project Kuiper 卫星星座项目购买发射服务时“违反了信义义务”。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>444次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/302.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/apple.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/725.html"> 苹果上线AppsbyApple网站,以推广自家应用程序 </a> </h3> <div class="tp-postitem-summary"> <p> 据消息,为推广自家应用,苹果现推出了一个名为“Apps by Apple”的网站,展示了苹果为旗下产品(如 iPhone、iPad、Apple Watch、Mac 和 Apple TV)开发的各种应用程序。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >442次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/725.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/tesla.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/647.html"> 特斯拉美国降价引发投资者不满:“这是短期麻醉剂” </a> </h3> <div class="tp-postitem-summary"> <p> 特斯拉本周在美国大幅下调Model S和X售价,引发了该公司一些最坚定支持者的不满。知名特斯拉多头、未来基金(Future Fund)管理合伙人加里·布莱克发帖称,降价是一种“短期麻醉剂”,会让潜在客户等待进一步降价。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >441次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/647.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/664.html"> 光刻机巨头阿斯麦:拿到许可,继续对华出口 </a> </h3> <div class="tp-postitem-summary"> <p> 据外媒9月2日报道,荷兰半导体设备制造商阿斯麦称,尽管荷兰政府颁布的半导体设备出口管制新规9月正式生效,但该公司已获得在2023年底以前向中国运送受限制芯片制造机器的许可。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>437次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/664.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/elonmask.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/118.html"> 马斯克与库克首次隔空合作:为苹果提供卫星服务 </a> </h3> <div class="tp-postitem-summary"> <p> 近日,根据美国证券交易委员会的文件显示,苹果卫星服务提供商 Globalstar 近期向马斯克旗下的 SpaceX 支付 6400 万美元(约 4.65 亿元人民币)。用于在 2023-2025 年期间,发射卫星,进一步扩展苹果 iPhone 系列的 SOS 卫星服务。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >430次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/118.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/elonmask.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/260.html"> 𝕏(推特)调整隐私政策,可拿用户发布的信息训练 AI 模型 </a> </h3> <div class="tp-postitem-summary"> <p> 据报道,马斯克旗下社交平台𝕏(推特)日前调整了隐私政策,允许 𝕏 使用用户发布的信息来训练其人工智能(AI)模型。新的隐私政策将于 9 月 29 日生效。新政策规定,𝕏可能会使用所收集到的平台信息和公开可用的信息,来帮助训练 𝕏 的机器学习或人工智能模型。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >428次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/260.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/214.html"> 荣耀CEO谈华为手机回归:替老同事们高兴,对行业也是好事 </a> </h3> <div class="tp-postitem-summary"> <p> 9月2日,荣耀CEO赵明在采访中谈及华为手机回归时表示,替老同事们高兴,觉得手机行业,由于华为的回归,让竞争充满了更多的可能性和更多的魅力,对行业来说也是件好事。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>423次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/214.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn/img/2023-09-01/ad1699b6ffae6610a2f72bdbe100ae3b"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/1/962.html"> AI操控无人机能力超越人类冠军 </a> </h3> <div class="tp-postitem-summary"> <p> 《自然》30日发表的一篇论文报道了一个名为Swift的人工智能(AI)系统,该系统驾驶无人机的能力可在真实世界中一对一冠军赛里战胜人类对手。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >423次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/1/962.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/openai.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/1/391.html"> AI生成的蘑菇科普书存在可致命错误 </a> </h3> <div class="tp-postitem-summary"> <p> 近日,非营利组织纽约真菌学会(NYMS)发出警告,表示亚马逊为代表的电商平台上,充斥着各种AI生成的蘑菇觅食科普书籍,其中存在诸多错误。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >420次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/1/391.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/elonmask.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/1/452.html"> 社交媒体平台𝕏计划收集用户生物识别数据与工作教育经历 </a> </h3> <div class="tp-postitem-summary"> <p> 社交媒体平台𝕏(原推特)新隐私政策提到:“在您同意的情况下,我们可能出于安全、安保和身份识别目的收集和使用您的生物识别信息。” </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >411次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/1/452.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/178.html"> 国产扫地机器人热销欧洲,国产割草机器人抢占欧洲草坪 </a> </h3> <div class="tp-postitem-summary"> <p> 2023年德国柏林消费电子展上,各大企业都带来了最新的理念和产品,而高端化、本土化的中国产品正在不断吸引欧洲等国际市场的目光。 </p> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span>406次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/178.html" target="_blank">详细内容 »</a> </div> </div> <div style="background-color: #eee;height:1px;margin:0px 0px;"></div> <div class="tp-postitem"> <div class="tp-postitem-thumbnailwrapper"> <img class="tp-postitem-thumbnailimg lazy" data-original="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/images/ent-logo-thumb/apple.jpg"/> </div> <div class="tp-postitem-textwrapper"> <h3 class="tp-postitem-title"> <a target="_blank" class="cleanurl" href="/doc/2023/9/4/268.html"> 罗永浩吐槽iPhone15和14不会有区别,除了序列号变了 </a> </h3> <div class="tp-postitem-summary"> <p> 罗永浩日前在直播中吐槽苹果即将推出的 iPhone 新品,具体内容为:“以我对我‘子公司’的了解,我认为 iPhone 15 跟 iPhone 14 不会有什么区别的,除了序(列)号变了,这个‘不要脸’的东西,这个‘臭厨子’。 </p> </div> </div> <div class="tp-postitem-bottom"> <span>发布于:1年以前</span>  |  <span >398次阅读</span>  |  <a class="cleanurl" href="/doc/2023/9/4/268.html" target="_blank">详细内容 »</a> </div> <div style="clear:both"></div> </div> </div> </div> <div style="height:8px;"></div> </div> <div class="three columns"> <!-- article h5entry --> <div class="sideblock"> <a href="https://m.hellobit.com.cn/doc/day/2018-10-08/9169.html"> <div style="padding:10px 10px 0px 10px;"> <div style="float:left;"> <img style="width:50px;height:50px;" src="/qrcode/aHR0cHM6Ly9tLmhlbGxvYml0LmNvbS5jbi9kb2MvZGF5LzIwMTgtMTAtMDgvOTE2OS5odG1s?size=400&margin=0"></img> </div> <div style="float:left;margin-left:10px;"> <p class="headline">扫码在手机上访问</p> <p class="descline">为您提供高质量的文档</p> </div> <div style="clear:both;"></div> </div> </a> </div> <div class="blockgap"></div> <!-- tech list --> <div class="sideblock"> <div class="block-title"><i class="fas fa-chart-line"></i><span> 相关文章</span></div> <div class="block-body"> <div style="border-bottom:1px dashed #eee;padding:8px 0px;"> <a class="urlblockv2 cleanurl" href="/doc/day/2018-09-22/8440.html"> <span class="fa fa-caret-right"></span> Android插件化方案 </a> <span style="font-size: 14px;color: #333;display:inline-block;">5年以前  <span style="color:#ccc;">|</span>  237152次阅读</span> </div> <div style="border-bottom:1px dashed #eee;padding:8px 0px;"> <a class="urlblockv2 cleanurl" href="/doc/2022/12/27/653.html"> <span class="fa fa-caret-right"></span> 前端录屏 + 定位源码,帮你快速定位线上 bug </a> <span style="font-size: 14px;color: #333;display:inline-block;">1年以前  <span style="color:#ccc;">|</span>  27693次阅读</span> </div> <div style="border-bottom:1px dashed #eee;padding:8px 0px;"> <a class="urlblockv2 cleanurl" href="/doc/2021/11/4/389.html"> <span class="fa fa-caret-right"></span> 飞书里面给链接生成一个预览是怎么做到的? </a> <span style="font-size: 14px;color: #333;display:inline-block;">2年以前  <span style="color:#ccc;">|</span>  9535次阅读</span> </div> <div style="border-bottom:1px dashed #eee;padding:8px 0px;"> <a class="urlblockv2 cleanurl" href="/doc/2022/10/19/765.html"> <span class="fa fa-caret-right"></span> vscode超好用的代码书签插件Bookmarks </a> <span style="font-size: 14px;color: #333;display:inline-block;">1年以前  <span style="color:#ccc;">|</span>  7933次阅读</span> </div> <div style="padding:8px;"> <a class="urlblockv2 cleanurl" href="/doc/2020/1/5/861.html"> <span class="fa fa-caret-right"></span> raw.githubusercontent.com被污染的解决办法 </a> <span style="font-size: 14px;color: #333;display:inline-block;">4年以前  <span style="color:#ccc;">|</span>  7766次阅读</span> </div> </div> </div> <div class="blockgap"></div> <!-- article toc, 放最后 --> <div id="toc_panel_all"> <div id="toc_panel"> <div class="sideblock right-menu"> <div class="block-title"><i class="fas fa-stream"></i><span> 目录</span></div> <div class="block-body"> <div id="toc" class="toc-container"></div> </div> </div> <div class="blockgap"></div> </div> <script> function onLoadTocTree(){ tocList(); } </script> <div class="sideblock" style="border-radius: 4px;"> <div class="_d3aes4p30wo" style="width:250px;height:250px;"></div> <script type="text/javascript"> (window.slotbydup = window.slotbydup || []).push({ id: "u1587556", container: "_d3aes4p30wo", async: true }); </script> </div> <div class="blockgap"></div> </div> </div> </div> </div> <br/> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/vendor/jquery/dist/jquery.min.js"></script> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/vendor/jqueryui/jquery-ui-core-widget.min.js"></script> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/vendor/jqueryui/jquery-ui-core-widget.min.js"></script> <link rel="stylesheet" href="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/v6/css/jquery.tocify.css"> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/v6/js/jquery.tocify.js"></script> <link rel="stylesheet" href="/themes/gr/toc/toc.css?ver=20231113"> <script src="/themes/gr/toc/toc.js?ver=20231113"></script> <script> var __isIEMode = false; </script> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/vendor/highlight(11.7)/highlight.min.js"></script> <script src="https://oss-cn-hangzhou.aliyuncs.com/codingsky/cdn1/codingsky/themes/gr/v6/js/lazyload.js"></script> <script src="/themes/gr/js/utils.js?ver=20231113"></script> <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script> var articleID = 29169 function onArticlePageLoaded(){ initArticlePage(); } </script> <div class="suspension-panel suspension-panel"> <button id="back-to-top" title="回到顶部" class="btn to-top-btn" style=""> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class=""><path data-v-01e634ce="" fill-rule="evenodd" clip-rule="evenodd" d="M2.75 1C2.33579 1 2 1.33579 2 1.75C2 2.16421 2.33579 2.5 2.75 2.5H13.25C13.6642 2.5 14 2.16421 14 1.75C14 1.33579 13.6642 1 13.25 1H2.75ZM7.24407 3.87287C7.64284 3.41241 8.35716 3.41241 8.75593 3.87287L13.0622 8.84535C13.6231 9.49299 13.163 10.5 12.3063 10.5H10V14C10 14.5523 9.55228 15 9 15H7C6.44772 15 6 14.5523 6 14V10.5H3.69371C2.83696 10.5 2.37691 9.49299 2.93778 8.84535L7.24407 3.87287Z" fill="#8A919F"></path></svg> </button> <button title="建议反馈" class="btn meiqia-btn" style=""> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="icon-feedback"><path data-v-01e634ce="" fill-rule="evenodd" clip-rule="evenodd" d="M1.8252 4.002C1.8252 2.80032 2.79935 1.82617 4.00102 1.82617H12.001C13.2027 1.82617 14.1768 2.80032 14.1768 4.002V9.71628C14.1768 10.918 13.2027 11.8921 12.001 11.8921H9.43308L6.92709 14.1281C6.4455 14.5578 5.68234 14.216 5.68234 13.5706V11.8921H4.00102C2.79934 11.8921 1.8252 10.918 1.8252 9.71628V4.002ZM11.2414 7.86753C11.3826 7.65526 11.3249 7.36878 11.1126 7.22764C10.9004 7.08651 10.6139 7.14417 10.4728 7.35643C9.94042 8.15705 9.03153 8.68309 7.99997 8.68309C6.96841 8.68309 6.05952 8.15705 5.52719 7.35643C5.38605 7.14417 5.09957 7.08651 4.88731 7.22764C4.67504 7.36878 4.61738 7.65526 4.75852 7.86753C5.45467 8.91452 6.64645 9.60617 7.99997 9.60617C9.35349 9.60617 10.5453 8.91452 11.2414 7.86753Z" fill="#1E80FF"></path></svg> </button> </div> <script> setTimeout(function(){ var btn = document.getElementById('back-to-top'); if(btn != null){ btn.onclick = function(){ $('body,html').animate({scrollTop:0},300) } } },1000) function initPageAfterCheckToken(){ if(typeof onInitSnippetPage === "function"){ onInitSnippetPage(); } if(typeof onInitSnippetViewPage === "function"){ onInitSnippetViewPage(); } if(typeof onArticlePageLoaded === "function"){ onArticlePageLoaded(); } if(typeof onLoadTocTree === "function"){ onLoadTocTree(); } if(typeof onInitBulmaDialog === "function"){ onInitBulmaDialog(); } } $(document).ready(function(){ initCurrentAuthUser(function(){ if(isLogined()){ $("#login-nav-menu").hide(); //$("#login-nav-menu").text("登录"); //$("#register-nav-menu").hide(); //$("#register-nav-menu").text("注册"); $("#userinfo-nav-menu").show(); $("#username-label").text(getDisplayName()); }else{ $("#login-nav-menu").show(); $("#userinfo-nav-menu").hide(); $("#userinfo-nav-menu-link").hide(); } initPageAfterCheckToken(); }); $('img.lazy').lazyload(); if(typeof wechatShareArticle === "function"){ wechatShareArticle(); } if(__isIEMode){ hljs.initHighlighting(); }else{ hljs.highlightAll(); } if(typeof onInitBookContentPage === "function"){ onInitBookContentPage(); } if(typeof onInitSearchPage === "function"){ onInitSearchPage(); } // 主界面右侧菜单点击 /*$('#userinfo-nav-menu').click(function(){ $("#dropMenuWrapper").toggle(); });*/ }); $(document).click(function(event){ var navMenuIds = ["userinfo-nav-menu","username-label","username-label-caret"] var eventId = $(event.target).attr("id"); var arrIndex = navMenuIds.indexOf(eventId); if(arrIndex >= 0){ return; } $("#dropMenuWrapper").hide(); }); </script> <div class="modal"> <div class="modal-background"></div> <div class="modal-card-body"> <ul> <li>收藏文章</li> </ul> </div> <button class="button">暂不登录</button> <a href="/user/login" class="button is-primary">去登录</a> </div> <div id="toLoginDialogGuide" class="modal"> <div class="modal-background"></div> <div class="modal-content" style="background-color:#fff;padding:22px 22px 22px 22px;width:400px;"> <h3>登录后可以享受更多权益</h3> <ul style="display:flex;justify-content: space-between;flex-wrap: wrap;flex-direction: row;"> <li class="login-guide-list-item"> <span class="icon-text"><span class="icon" style="color:#3472F7;"><i class="fab fa-dochub"></i></span><span>收藏有用的文章</span></span> </li> <li class="login-guide-list-item"> <span class="icon-text"><span class="icon" style="color:#3472F7;"><i class="fab fa-codepen"></i></span><span>整理自己的代码</span></span> </li> <li class="login-guide-list-item"> <span class="icon-text"><span class="icon" style="color:#3472F7;"><i class="fas fa-history"></i></span><span>查阅浏览足迹</span></span> </li> <li class="login-guide-list-item"> <span class="icon-text"><span class="icon" style="color:#3472F7;"><i class="fas fa-exchange-alt"></i></span><span>多个平台共享账号</span></span> </li> </ul> <a href="/user/login" style="width:100%;" class="button is-primary">去登录</a> <p>首次使用?从这里 <a href="/user/login" class="cleanurl">注册</a></p> </div> </div> <!-- baidu union --> <script type="text/javascript" src="//cpro.baidustatic.com/cpro/ui/c.js" async="async" defer="defer" ></script> <!-- Global site tag (gtag.js) - Google Analytics <script async src="https://www.googletagmanager.com/gtag/js?id=UA-108792812-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-108792812-1'); </script> --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?713c92a31aa12d55b910e2065c7cda9d"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script> /*var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?e066867ae5a323a82641e57db7e7c914"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();*/ </script> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> <!-- <script type="text/javascript" src="http://tajs.qq.com/stats?sId=66376258" charset="UTF-8"></script> --> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-2VE3RBLF6N"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-2VE3RBLF6N'); </script> </body> </html>