Magento 2 How to get category by url_key
<p>I try to get a category in Magento 2.0 by it url_key. </p>

<p>Now I've got :</p>

<pre><code>        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $categoryFactory = $objectManager-&gt;create('Magento\Catalog\Model\CategoryFactory');
        $category = $categoryFactory-&gt;create()
            -&gt;addAttributeToFilter('url_key','my_category_url_key');
</code></pre>

<p>It returns me this error :</p>

<blockquote>
  <p>Error filtering template: Invalid method
  Magento\Catalog\Model\Category\Interceptor::addAttributeToFilter(Array
  ( [0] => url_key [1] => my_category_url_key ) )</p>
</blockquote>

<p>Thanks.</p>